Download presentation
Presentation is loading. Please wait.
Published byRoss Daniels Modified over 8 years ago
1
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Chapter 2: Operating-System Structures
2
2.2 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Chapter 2: Operating-System Structures Operating System Services User Operating System Interface System Calls System Programs Operating System Design and Implementation Operating System Structure System Boot
3
2.3 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Objectives Describe services that operating system provides Discuss various ways of structuring an OS Explain how operating systems are installed and how they boot
4
2.4 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Operating System Services Operating systems provide an environment for: Execution of programs Services to programs and users OS provides services for user: User interface - Almost all operating systems have a userinterface (UI). Varies between Command-Line (CLI), Graphics User Interface (GUI), Batch
5
2.5 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Operating System Services OS provides services for user (cont.): Program execution – Load a program into memory Run that program End execution, either normally or abnormally
6
2.6 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Operating System Services OS provides services for user (cont.): I/O operations - running program may require I/O File I/O Device I/O
7
2.7 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Operating System Services OS provides services for user (cont.): File-system manipulation Read and write files and directories Create and delete Search List file information, permission
8
2.8 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Operating System Services OS provides services for user (cont.) Communications – Processes may exchange information, on same computer or between computers over a network Communications may be via: – shared memory – message passing
9
2.9 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Operating System Services OS provides services for user (cont.) Error detection – OS constantly aware of possible errors CPUs, memory hardware, I/O devices, user program OS should take the appropriate action
10
2.10 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Operating System Services OS provides services for resource sharing Resource allocation – to multiple concurrent users and jobs CPU cycles Main memory File storage I/O devices.
11
2.11 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Operating System Services OS provides services for resource sharing Accounting - keep track of computer resources Protection and security - control use of information and eliminate process interference Protection - controlled access to system resources Security – defend from outsiders
12
2.12 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition A View of Operating System Services
13
2.13 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition User Operating System Interface - CLI Command interpreter - direct command entry Implemented in kernel or as systems program Multiple flavors – shells Fetches command from user and executes it Commands can be built-in Commands as names of programs Adding new features doesn’t require shell modification
14
2.14 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Bourne Shell Command Interpreter
15
2.15 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition User Operating System Interface - GUI User-friendly desktop metaphor interface Usually mouse, keyboard, monitor Icons represent files, programs, actions, etc. Mouse buttons cause various actions Invented at Xerox PARC
16
2.16 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition User Operating System Interface - GUI 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)
17
2.17 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Touchscreen Interfaces Touchscreen devices require new interfaces Mouse not possible Actions based on gestures Virtual keyboard for text entry Voice commands.
18
2.18 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition The Mac OS X GUI
19
2.19 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition System Calls Programming interface to services provided by OS Typically written in high-level language (e.g., C) Mostly accessed via high-level Application Programming Interface (API) Rather than direct system call use Three most common APIs: Win32 API for Windows POSIX API for POSIX-based systems (UNIX, Linux) Java API for Java virtual machine (JVM)
20
2.20 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Example of System Calls System calls to copy contents of one file to another
21
2.21 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition System Call Implementation Typically, number associated with system call System-call interface maintains table indexed accordingly System call interface invokes the intended system call in OS kernel, Returns status of the system call and any return values
22
2.22 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition System Call Implementation Caller need not know system call’s implementation Caller needs to obey API Most details of OS interface hidden by API Managed by run-time support library
23
2.23 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition API – System Call – OS Relationship
24
2.24 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Types of System Calls Process control create process, terminate process end, abort load, execute get process attributes, set process attributes wait for time wait event, signal event allocate and free memory Dump memory if error Debugger for determining bugs, single step execution Locks for managing access to shared data between processes
25
2.25 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Types of System Calls File management create file, delete file open, close file read, write, reposition get and set file attributes
26
2.26 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Types of System Calls Device management request device, release device read, write, reposition get device attributes, set device attributes logically attach or detach devices
27
2.27 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Types of System Calls (Cont.) Information maintenance get time or date, set time or date get system data, set system data get and set process, file, or device attributes
28
2.28 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Types of System Calls (Cont.) Communications create, delete communication connection send, receive messages if message passing model to host name or process name From client to server Shared-memory model create and gain access to memory regions transfer status information attach and detach remote devices
29
2.29 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Types of System Calls (Cont.) Protection Control access to resources Get and set permissions Allow and deny user access
30
2.30 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Examples of Windows and Unix System Calls
31
2.31 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Standard C Library Example C -> printf() library call -> write() system call
32
2.32 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Example: MS-DOS Single-tasking Shell invoked on system boot Simple method to run program No process created Single memory space Loads program into memory, overwriting all but the kernel Program exit -> shell reloaded At system startup running a program
33
2.33 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Example: FreeBSD Unix variant Multitasking User login -> invoke user’s choice of shell Shell executes fork() to create process exec() to load program into process Shell waits for process to terminate or continues with user commands
34
2.34 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition System Programs System programs provide convenient environment for program development and execution File manipulation Status information Programming language support Program loading and execution Communication Background services Application programs
35
2.35 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Example System Programs File management - Create, delete, copy, rename, print, dump, list, and generally manipulate files and directories
36
2.36 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Example System Programs Status information Ask OS for info - date, time, amount of available memory, disk space, number of users Provide detailed performance, logging, and debugging info Some systems implement a registry - used to store and retrieve configuration information
37
2.37 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Example System Programs File modification Text editors to create and modify files Special commands to search contents of files or perform transformations of the text
38
2.38 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Example System Programs Programming-language support – Compilers Assemblers Debuggers Interpreters
39
2.39 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Example System Programs Program loading and execution- Loaders Linkers Debugging systems for higher-level and machine language
40
2.40 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Example System Programs Communications – Provide mechanism for creating virtual connections among processes, users, and computer systems Send messages to screens, browse web pages, send electronic-mail messages, log in remotely, transfer files
41
2.41 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Example System Programs Background Services Launched at boot time Some for system startup, then terminate Some from system boot to shutdown Provide facilities like disk checking, process scheduling, error logging, printing Run in user context not kernel context Known as services, subsystems, daemons
42
2.42 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Example System Programs Application programs Don’t pertain to system Run by users Not typically considered part of OS Launched by command line, mouse click, finger poke
43
2.43 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Operating System Design and Implementation Design and Implementation of OS not “solvable” Some approaches have proven successful Internal structure of OS can vary Start by defining goals and specifications
44
2.44 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Operating System Design and Implementation Affected by hardware choice, type of system User goals and System goals User goals – operating system should be: convenient, easy, reliable, safe, and fast System goals – operating system should be: easy to design, implement, and maintain, flexible, reliable, error-free, and efficient
45
2.45 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Implementation Much variation Early OSes in assembly language Then system programming languages like Algol, PL/1 Now C, C++ Actually usually a mix of languages Lowest levels in assembly Main body in C Systems programs in C, C++, scripting languages like PERL, Python, shell scripts
46
2.46 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Implementation High-level language easier to port to other hardware But slower Emulation allows OS to run on non-native hardware
47
2.47 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Operating System Structure General-purpose OS is very large program Various ways to structure ones Simple structure – MS-DOS More complex -- UNIX Layered – an abstrcation Microkernel -Mach
48
2.48 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Simple Structure -- MS-DOS Provide most functionality in least space Not divided into modules Interfaces and levels of functionality are not well separated
49
2.49 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Non Simple Structure -- UNIX UNIX –OS consists of two separable parts Systems programs Kernel Everything below system-call interface and above physical hardware Provides file system, CPU scheduling, memory management, and other operating-system functions – Large number of functions for one level
50
2.50 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Traditional UNIX System Structure
51
2.51 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Layered Approach OS divided into layers (levels), each built on top of lower layers. Bottom layer (layer 0), is hardware Highest (layer N) is user interface. Layers only use services of lower-level layers
52
2.52 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Microkernel System Structure Moves much kernel into user space Mach example of microkernel OS X kernel (Darwin) partly based on Mach Communication takes place between user modules using message passing
53
2.53 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Microkernel System Structure Benefits: Easier to extend microkernel Easier to port the operating system to different architectures More reliable (less code is running in kernel mode) More secure Detriments: Overhead of user to kernel space communications
54
2.54 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Microkernel System Structure
55
2.55 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Modules Modern OS implement loadable kernel modules Uses object-oriented approach Each core component is separate Each talks to others over known interfaces Each is loadable as needed Overall, similar to layers but with more flexible Linux, Solaris, etc
56
2.56 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Solaris Modular Approach
57
2.57 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Hybrid Systems Most modern OS are not one pure model Hybrid combines multiple approaches to address performance, security, usability needs Linux and Solaris kernels in kernel address space, so monolithic Plus modular for dynamic loading of functionality Windows mostly monolithic Plus microkernel for different subsystem personalities
58
2.58 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Hybrid Systems Apple Mac OS X hybrid, layered, Aqua UI plus Cocoa programming environment Kernel consists of: Mach microkernel BSD Unix parts I/O kit Dynamically loadable modules (kernel extensions)
59
2.59 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Mac OS X Structure
60
2.60 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition iOS Apple mobile OS for iPhone, iPad Structured on Mac OS X, w/ added functionality Does not run OS X applications natively Also runs on different CPU architecture (ARM vs. Intel)
61
2.61 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition iOS Cocoa Touch Objective-C API for developing apps Media services layer for graphics, audio, video Core services provides cloud computing, databases Core operating system, based on Mac OS X kernel
62
2.62 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Android Developed by Open Handset Alliance (mostly Google) Open Source Similar stack to IOS Based on Linux kernel Provides process, memory, device-driver management Adds power management
63
2.63 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Android 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
64
2.64 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Android Architecture
65
2.65 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Operating-System Debugging Kernighan’s Law: “Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.”
66
2.66 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition System Boot When power initialized, execution starts at fixed memory location Firmware ROM used to hold boot code Operating system must be made available to hardware Small piece of code – bootstrap loader, stored in ROM or EEPROM: locates the kernel, loads it into memory, starts it Sometimes two-step process where: boot block at fixed location loaded by ROM code which loads bootstrap loader from disk
67
2.67 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition System Boot Common bootstrap loader, GRUB, allows selection of kernel from multiple disks, versions, kernel options Kernel loads and system is then running
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.