Chapter 2: Operating-System Structures PDF

Summary

This document is chapter 2 from the textbook "Operating System Concepts", 9th edition. It covers operating system structures, including user interfaces, system calls, and operating system design.

Full Transcript

Chapter 2: Operating-System Structures Operating System Concepts – 9th Edition Silberschatz, Galvin and Gagne ©2013 Objectives To describe the services an operating system provides to users, processes,...

Chapter 2: Operating-System Structures Operating System Concepts – 9th Edition Silberschatz, Galvin and Gagne ©2013 Objectives To describe the services an operating system provides to users, processes, and other systems To identify types of system calls To discuss the various ways of structuring an operating system To explain how operating systems are booted Operating System Concepts – 9th Edition 2.2 Silberschatz, Galvin and Gagne ©2013 2.1 Operating System Services Operating systems provide an environment for the execution of programs. Operating systems provides certain services to:  Programs  Users of those programs Basically two types of services:  Set of operating-system services provides functions that are helpful to the user:  Set of operating-system functions for ensuring the efficient operation of the system itself via resource sharing Operating System Concepts – 9th Edition 2.3 Silberschatz, Galvin and Gagne ©2013 2.2 User and OS Interface One of the many OS services is User interface. User interface - Almost all operating systems have a user interface (UI). This interface can take several forms:  Command-Line (CLI) -- uses text commands and a method for entering them (say, a keyboard for typing in commands in a specific format with specific options).  Graphics User Interface (GUI) -- the interface is a window system with a pointing device to direct I\O, choose from menus, and make selections and a keyboard to enter text..  Batch Interface -- commands and directives to control those commands are entered into files, and those files are executed *Some systems provide two or all three of these variations. Operating System Concepts – 9th Edition 2.4 Silberschatz, Galvin and Gagne ©2013 A View of Operating System Services Figure 2.1 Operating System Concepts – 9th Edition 2.5 Silberschatz, Galvin and Gagne ©2013 2.2.1 Command Interpreters (CLI) CLI allows users to directly enter commands to be performed by the operating system. Some operating systems include the command interpreter in the kernel. Some operating systems, such as Windows and UNIX, treat the command interpreter as a special program that is running when a job is initiated or when a user first logs on. On systems with multiple command interpreters to choose from, the interpreters are known as shells. The main function of the command interpreter is to get and execute the next user-specified command. Sometimes commands built-in, sometimes just names of programs  If the latter, adding new features doesn’t require shell modification Operating System Concepts – 9th Edition 2.6 Silberschatz, Galvin and Gagne ©2013 The Bourne shell command interpreter in Solaris Operating System Concepts – 9th Edition 2.7 Silberschatz, Galvin and Gagne ©2013 2.2.2 Graphical User Interfaces (GUI) User-friendly desktop metaphor interface  Usually mouse, keyboard, and monitor  Icons represent files, programs, actions, etc  Various mouse buttons over objects in the interface cause various actions (provide information, options, execute function, open directory (known as a folder)  Invented at Xerox PARC Many systems now include both CLI and GUI interfaces  Microsoft Windows is GUI with CLI “command” shell  Apple Mac OS X is “Aqua” GUI interface with UNIX kernel underneath and shells available  Unix and Linux have CLI with optional GUI interfaces (CDE, KDE, GNOME) Operating System Concepts – 9th Edition 2.8 Silberschatz, Galvin and Gagne ©2013 Touchscreen Interfaces Touchscreen devices require new interfaces  Mouse not possible or not desired  Actions and selection based on gestures  Virtual keyboard for text entry  Voice commands. Operating System Concepts – 9th Edition 2.9 Silberschatz, Galvin and Gagne ©2013 The Mac OS X GUI Figure 2.4 Operating System Concepts – 9th Edition 2.10 Silberschatz, Galvin and Gagne ©2013 2.3 System Calls Programming interface to the services provided by the OS Typically written in a high-level language (C or C++) Mostly accessed by programs via a high-level Application Programming Interface (API) rather than direct system call Three most common APIs are:  Win32 API for Windows,  POSIX API for POSIX-based systems (including virtually all versions of UNIX, Linux, and Mac OS X),  Java API for the Java virtual machine (JVM) *Note that the system-call names used throughout this text are generic Operating System Concepts – 9th Edition 2.11 Silberschatz, Galvin and Gagne ©2013 Example of System Calls System call sequence to copy the contents of one file to another file Figure 2.5 Operating System Concepts – 9th Edition 2.12 Silberschatz, Galvin and Gagne ©2013 Example of Standard API Operating System Concepts – 9th Edition 2.13 Silberschatz, Galvin and Gagne ©2013 2.4 Types of System Calls System calls can be grouped roughly into six major categories:  Process control,  File manipulation,  Device manipulation,  Information maintenance,  Communications,  Protection. Operating System Concepts – 9th Edition 2.14 Silberschatz, Galvin and Gagne ©2013 Examples of Windows and Unix System Calls Operating System Concepts – 9th Edition 2.15 Silberschatz, Galvin and Gagne ©2013 2.5 System Programs System programs provide a convenient environment for program development and execution. Some of them are simply user interfaces to system calls. Others are considerably more complex. They can be divided into:  File manipulation  Status information sometimes stored in a File modification  Programming language support  Program loading and execution  Communications  Background services  Application programs Most users’ view of the operation system is defined by system programs, not the actual system calls Operating System Concepts – 9th Edition 2.16 Silberschatz, Galvin and Gagne ©2013 2.7 Operating System Structure Various ways to structure an operating system:  Monolithic structure  Simple structure – MS-DOS  More complex – UNIX  More complex – Linux  Layered – An abstraction  Microkernel - Mach Operating System Concepts – 9th Edition 2.17 Silberschatz, Galvin and Gagne ©2013 2.7.1 Monolitic- Simple Structure: MS-DOS MS-DOS – written to provide the most functionality in the least amount of space MS-DOS was limited by hardware funcionality.  Not divided into modules  Although MS-DOS has some structure, its interfaces and levels of functionality are not well separated Operating System Concepts – 9th Edition 2.18 Silberschatz, Galvin and Gagne ©2013 2.7.1 Monolitic-More Complex: UNIX UNIX – the original UNIX operating system had limited structuring and was limited by hardware functionality. The UNIX OS consists of two separable parts  Systems programs  The kernel  Consists of everything below the system-call interface and above the physical hardware  Provides the file system, CPU scheduling, memory management, and other operating-system functions; a large number of functions for one level Operating System Concepts – 9th Edition 2.19 Silberschatz, Galvin and Gagne ©2013 Traditional UNIX System Structure Figure 2.12 Operating System Concepts – 9th Edition 2.20 Silberschatz, Galvin and Gagne ©2013 Linux System Structure Operating System Concepts – 9th Edition 2.21 Silberschatz, Galvin and Gagne ©2013 2.7.2 Layered Approach A system can be made modular in many ways. One method is the layered approach, in which the operating system is broken into a number of layers (levels). The bottom layer (layer 0) is the hardware; the highest (layer N) is the user interface. Figure 2.13 Operating System Concepts – 9th Edition 2.22 Silberschatz, Galvin and Gagne ©2013 2.7.3 Microkernel System Structure Moves as much from the kernel into user space Mach example of microkernel  Mac OS X kernel (Darwin) partly based on Mach Communication takes place between user modules using message passing Benefits:  Easier to extend a microkernel  Easier to port the operating system to new architectures  More reliable (less code is running in kernel mode)  More secure Detriments:  Performance overhead of user space to kernel space communication Operating System Concepts – 9th Edition 2.23 Silberschatz, Galvin and Gagne ©2013 Microkernel System Structure Figure 2.14 Operating System Concepts – 9th Edition 2.24 Silberschatz, Galvin and Gagne ©2013 2.7.4 Modules Many modern operating systems implement loadable kernel modules  Uses object-oriented approach  Each core component is separate  Each talks to the others over known interfaces  Each is loadable as needed within the kernel Overall, similar to layers but with more flexible  Linux, Solaris, etc Operating System Concepts – 9th Edition 2.25 Silberschatz, Galvin and Gagne ©2013 2.7.5 Hybrid Systems In practice, very few operating systems adopt a single, strictly defined structure. Instead, they combine different structures, resulting in hybrid systems that address performance, security, and usability issues.  For example, Linux is monolithic, because having the operating system in a single address space provides very efficient performance. However, Linux are also modular, so that new functionality can be dynamically added to the kernel. Examples of the structure of hybrid systems:  Apple Mac operating system (laptop)  iOS (mobile operating systems)  Android (mobile operating systems) Operating System Concepts – 9th Edition 2.26 Silberschatz, Galvin and Gagne ©2013 Architecture of Mac OS X and iOS Operating System Concepts – 9th Edition 2.27 Silberschatz, Galvin and Gagne ©2013 Android Developed by Open Handset Alliance (mostly Google)  Open Source Similar stack to iOS Based on Linux kernel but modified  Provides process, memory, device-driver management  Adds power management Runtime environment includes core set of libraries and Dalvik virtual machine  Apps developed in Java plus Android API  Java class files compiled to Java bytecode then translated to executable than runs in Dalvik VM Libraries include frameworks for web browser (webkit), database (SQLite), multimedia, smaller libc Operating System Concepts – 9th Edition 2.28 Silberschatz, Galvin and Gagne ©2013 Android Architecture Operating System Concepts – 9th Edition 2.29 Silberschatz, Galvin and Gagne ©2013 2.8 System Boot When power initialized on system, execution starts at a fixed memory location  Firmware ROM used to hold initial boot code Operating system must be made available to hardware so hardware can start it  Small piece of code – bootstrap loader, stored in ROM or EEPROM locates the kernel, loads it into memory, and starts it  Sometimes two-step process where boot block at fixed location loaded by ROM code, which loads bootstrap loader from disk Common bootstrap loader, GRUB, allows selection of kernel from multiple disks, versions, kernel options Kernel loads and system is then running Operating System Concepts – 9th Edition 2.30 Silberschatz, Galvin and Gagne ©2013 EXERCISE From Silberchatz, Operating System Concepts Chapter 2 Exercises  Odd number Matric card – 2.1, 2.11, 2.13  Even number Matric card – 2.6, 2.10, 2.12  Due date: Submit to e-learning 5 days after you receive the textbook. Operating System Concepts – 9th Edition 2.31 Silberschatz, Galvin and Gagne ©2013 End of Chapter 2 Operating System Concepts – 9th Edition Silberschatz, Galvin and Gagne ©2013

Use Quizgecko on...
Browser
Browser