4/1/2018 Resources, Services, and Interfaces Services: Hardware Abstractions • CPU/Memory abstractions 2A. OS Services, Layers and Mechanisms – processes, threads, virtual machines 2B. Service Interfaces – virtual address spaces, shared segments 2C. Standards and Stability – signals (as execution exceptions) 2D. Services and Abstract Resources • Persistent Storage abstractions – files and file systems, virtual LUNs – databases, key/value stores, object stores • other I/O abstractions – virtual terminal sessions, windows – sockets, pipes, VPNs, signals (as interrupts) Resources, Services, and Interfaces 1 Resources, Services, and Interfaces 2 Services: Higher Level Abstractions Services: under the covers • cooperating parallel processes • enclosure management – locks, condition variables – hot-plug, power, fans, fault handling – distributed transactions, leases • software updates and configuration registry • security • dynamic resource allocation and scheduling – user authentication – CPU, memory, bus resources, disk, network – secure sessions, at-rest encryption • networks, protocols and domain services • user interface – USB, BlueTooth – GUI widgetry, desktop and window management – TCP/IP, DHCP, LDAP, SNMP – multi-media – iSCSI, CIFS, NFS Resources, Services, and Interfaces 3 Resources, Services, and Interfaces 4 Software Layering Service delivery via subroutines • access services via direct subroutine calls (user and system) applications – push parameters, jump to subroutine, return values in registers on on the stack Operating System middle-ware • advantages services services Application Binary Interface – extremely fast (nano-seconds) general libraries – DLLs enable run-time implementation binding • disadvantages drivers Operating System kernel – all services implemented in same address space Instruction Set Architecture – limited ability to combine different languages privileged devices general instruction set – limited ability to change library functionality instruction set Introduction to Operating Systems 5 Resources, Services, and Interfaces 6 1
4/1/2018 Layers: libraries Service delivery via system calls • force an entry into the operating system • convenient functions we use all the time – parameters/returns similar to subroutine – reusable code makes programming easier – implementation is in shared/trusted kernel – a single well written/maintained copy • advantages – encapsulates complexity … better building blocks – able to allocate/use new/privileged resources • multiple bind-time options – able to share/communicate with other processes – static … include in load module at link time • disadvantages – shared … map into address space at exec time – all implemented on the local node – dynamic … choose and load at run-time – 100x-1000x slower than subroutine calls • it is only code … it has no special privileges – evolution is very slow and expensive Resources, Services, and Interfaces 7 Resources, Services, and Interfaces 8 Software Layering Layers: the kernel • primarily functions that require privilege (user and system) applications – privileged instructions (e.g. interrupts, I/O) Operating System middle-ware – allocation of physical resources (e.g. memory) services services Application Binary Interface – ensuring process privacy and containment – ensuring the integrity of critical resources general libraries • some operations may be out-sourced drivers Operating System kernel – system daemons, server processes Instruction Set Architecture • some plug-ins may be less-trusted privileged devices general instruction set – device drivers, file systems, network protocols instruction set Introduction to Operating Systems 9 Resources, Services, and Interfaces 10 Kernel Structure (artists conception) Service delivery via messages • exchange messages with a server (via syscalls) system call interfaces user visible OS model file namespace authorization file file I/O IPC process/thread exception synchronization – parameters in request, returns in response model model model model model model model model • advantages: run-time configuration fault quality … higher level transport file systems loader services management of service services protocols – server can be anywhere on earth stream volume hot-plug block I/O services management services services – service can be highly scalable and available memory logging swapping paging scheduling & tracing network serial display storage I/O class driver class driver class driver class driver abstraction virtual – service can be implemented in user-mode code 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 – 1,000x-100,000x slower than subroutine boot I/O resource enclosure processor processor context kernel processor strap allocation management exceptions initialization switching debugger abstraction – limited ability to operate on process resources 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 11 Resources, Services, and Interfaces 12 2
4/1/2018 Software Layering Layers: system services • not all trusted code must be in the kernel (user and system) applications – it may not need to access kernel data structures – it may not need to execute privileged instructions Operating System middle-ware services services Application Binary Interface • some are actually privileged processes – login can create/set user credentials general libraries – some can directly execute I/O operations drivers Operating System kernel • some are merely trusted Instruction Set Architecture – sendmail is trusted to properly label messages privileged devices general instruction set – NFS server is trusted to honor access control data instruction set Introduction to Operating Systems 13 Resources, Services, and Interfaces 14 Layers: middle-ware Where to implement a service • Software that is a key part of the application • How many different applications use it? or service platform, but not part of the OS • How frequently is it used? – database, pub/sub messaging system • How performance critical are the operations? – Apache, Nginx • How stable/standard is the functionality? – Hadoop, Zookeeper, Beowulf, OpenStack – Cassandra, RAMCloud, Ceph, Gluster • How complex is the implementation? • Kernel code is very expensive and dangerous • Are there issues of privilege or trust? – user-mode code is easier to build, test and debug • Is the service to be local or distributed? – user-mode code is much more portable • Are there to be competing implementations? – user-mode code can crash and be restarted Resources, Services, and Interfaces 15 Introduction to Operating Systems 16 Is it faster if it is in the OS? Why Do Interfaces Matter? • OS is no faster than a user-mode process • primary value of OS is the apps it can run – CPU, instruction set, cache are the same – it must provide all services those apps need • some services involve expensive operations – via the interfaces those apps expect • correct application behavior depends on – servicing interrupts … faster in the kernel – making system calls … unnecessary in kernel – OS correctly implements all required services – process switches … faster/less often in kernel – application uses services only in supported ways • but kernel code is very expensive • there are numerous apps and OS platforms – difficult to build and test – it is not possible to test all combinations – long delivery schedules, difficult to change – rather, we specify and test interface compliance Introduction to Operating Systems 17 Resources, Services, and Interfaces 18 3
Recommend
More recommend