3/31/2016 Resources, Services, and Interfaces 2A. Operating Systems Services 2B. System Service Layers and Mechanisms Operating Systems Principles 2C. Service Interfaces and Standards Resources, Services, and Interfaces 2D. Service and Interface Abstractions Mark Kampe (markk@cs.ucla.edu) Resources, Services, and Interfaces 2 Services: Hardware Abstractions Services: Higher Level Abstractions • CPU/Memory abstractions • cooperating parallel processes – processes, threads, virtual machines – locks, condition variables – virtual address spaces, shared segments – distributed transactions, leases – signals (as execution exceptions) • security • Persistent Storage abstractions – user authentication – files and file systems, virtual LUNs – secure sessions, at-rest encryption – databases, key/value stores, object stores • user interface • other I/O abstractions – GUI widgetry, desktop and window management – virtual terminal sessions, windows – multi-media – sockets, pipes, VPNs, signals (as interrupts) Resources, Services, and Interfaces 3 Resources, Services, and Interfaces 4 Services: under the covers Software Layering • enclosure management (user and system) applications – hot-plug, power, fans, fault handling • software updates and configuration registry Operating System middle-ware services services Application Binary Interface • dynamic resource allocation and scheduling – CPU, memory, bus resources, disk, network general libraries • networks, protocols and domain services drivers Operating System kernel – USB, BlueTooth Instruction Set Architecture – TCP/IP, DHCP, LDAP, SNMP privileged devices general instruction set instruction set – iSCSI, CIFS, NFS Resources, Services, and Interfaces 5 Introduction to Operating Systems 6 1
3/31/2016 Service delivery via subroutines Layers: libraries • access services via direct subroutine calls • convenient functions we use all the time – push parameters, jump to subroutine, return – reusable code makes programming easier values in registers on on the stack – a single well written/maintained copy • advantages – encapsulates complexity … better building blocks – extremely fast (nano-seconds) • multiple bind-time options – DLLs enable run-time implementation binding – static … include in load module at link time • disadvantages – shared … map into address space at exec time – all services implemented in same address space – dynamic … choose and load at run-time – limited ability to combine different languages • it is only code … it has no special privileges Resources, Services, and Interfaces 7 Resources, Services, and Interfaces 8 Kernel Structure (artists conception) Service delivery via system calls • force an entry into the operating system system call interfaces user visible OS model file namespace authorization file file I/O IPC process/thread exception synchronization – parameters/returns similar to subroutine model model model model model model model model – implementation is in shared/trusted kernel run-time configuration fault quality … higher level transport file systems loader services management of service protocols services • advantages stream volume hot-plug block I/O services management services services – able to allocate/use new/privileged resources memory logging swapping paging scheduling & tracing network serial display storage I/O class driver class driver class driver class driver abstraction virtual – able to share/communicate with other processes execution fault process/thread processes asynchronous engine device drivers device drivers handling scheduling (resource containers) events • disadvantages DMA configuration thread memory memory thread bus drivers services analysis dispatching allocation segments synchronization – all implemented on the local node boot I/O resource enclosure processor processor context kernel processor strap allocation management exceptions initialization switching debugger abstraction – 100x-1000x slower than subroutine calls I/O processor processor memory memory cache cache atomic atomic DMA interrupts interrupts traps traps timers timers operations mode mode mapping mapping mgmt mgmt updates updates Resources, Services, and Interfaces 9 Resources, Services, and Interfaces 10 Layers: the kernel Virtualizing Physical Resources • primarily functions that require privilege • serially reusable (temporal multiplexing) – privileged instructions (e.g. interrupts, I/O) – used by multiple clients, one at a time – allocation of physical resources (e.g. memory) – requires access control to ensure exclusive access – ensuring process privacy and containment • partitionable resources (spatial multiplexing) – ensuring the integrity of critical resources – different clients use different parts at same time • some operations may be out-sourced – requires access control for containment/privacy – system daemons, server processes • sharable (no apparent partitioning or turns) • some plug-ins may be less-trusted – often involves mediated access – device drivers, file systems, network protocols – often involves under-the-covers multiplexing Resources, Services, and Interfaces 11 Resources, Services, and Interfaces 12 2
3/31/2016 Layers: system services Service delivery via messages • not all trusted code must be in the kernel • exchange messages with a server (via syscalls) – it may not need to access kernel data structures – parameters in request, returns in response – it may not need to execute privileged instructions • advantages: • some are actually privileged processes – server can be anywhere on earth – login can create/set user credentials – service can be highly scalable and available – some can directly execute I/O operations – service can be implemented in user-mode code • some are merely trusted • disadvantages: – sendmail is trusted to properly label messages – 1,000x-100,000x slower than subroutine – NFS server is trusted to honor access control data – limited ability to operate on process resources Resources, Services, and Interfaces 13 Resources, Services, and Interfaces 14 Layers: middle-ware Application Programming Interfaces • Software that is a key part of the application • a source level interface, specifying or service platform, but not part of the OS – include files – database, pub/sub messaging system – data types, data structures, constants – Apache, Nginx – macros, routines, parameters, return values – Hadoop, Zookeeper, Beowulf, OpenStack • a basis for software portability – Cassandra, RAMCloud, Ceph, Gluster – recompile program for the desired ISA • Kernel code is very expensive and dangerous – linkage edit with OS-specific libraries – user-mode code is easier to build, test and debug – resulting binary runs on that ISA and OS – user-mode code is much more portable – user-mode code can crash and be restarted Resources, Services, and Interfaces 15 Resources, Services, and Interfaces 16 Application Binary Interfaces Other interoperability interfaces • a binary interface, specifying • Data formats and information encodings – load module, object module, library formats – multi-media content (e.g. MP3, JPG) – data formats (types, sizes, alignment, byte order) – archival (e.g. tar, gzip) – calling sequences, linkage conventions – file systems (e.g. DOS/FAT, ISO 9660) • a basis for binary compatibility • Protocols – one binary will run on any ABI compliant system – networking (e.g. ethernet, WLAN, TCP/IP) • e.g. all x86 Linux/BSD/OSx/Solaris/… – domain services (e.g. IMAP, LPD) • may even run on windows platforms – system management (e.g. DHCP, SNMP, LDAP) – remote data access (e.g. FTP, HTTP, CIFS, S3) Resources, Services, and Interfaces 17 Resources, Services, and Interfaces 18 3
Recommend
More recommend