Top Banner
Chap 2 Chap 2 System Structures System Structures
24

Chap 2 System Structures. Operating System Services One set of operating-system services provides functions that are helpful to the user: –User interface.

Dec 16, 2015

Download

Documents

Jaliyah Spry
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Chap 2 System Structures. Operating System Services One set of operating-system services provides functions that are helpful to the user: –User interface.

Chap 2Chap 2Chap 2Chap 2

System StructuresSystem Structures

Page 2: Chap 2 System Structures. Operating System Services One set of operating-system services provides functions that are helpful to the user: –User interface.

Operating System Services

• One set of operating-system services provides functions that are helpful to the user:– User interface

• Varies between Command-Line (CLI), Graphics User Interface (GUI), Batch

– Program execution

– I/O operations

– File-system

– Communications – Processes may exchange information, on the same computer or between computers over a network

– Error detection

Page 3: Chap 2 System Structures. Operating System Services One set of operating-system services provides functions that are helpful to the user: –User interface.

Operating System Services (Cont.)

• Another set of OS functions exists for ensuring the efficient operation of the system itself via resource sharing– Resource allocation - When multiple users or multiple

jobs running concurrently, resources must be allocated to each of them

– Accounting - To keep track of which users use how much and what kinds of computer resources

– Protection and security - The owners of information stored in a multiuser or networked computer system may want to control use of that information, concurrent processes should not interfere with each other

Page 4: Chap 2 System Structures. Operating System Services One set of operating-system services provides functions that are helpful to the user: –User interface.

User Operating System Interface

• Command interpreter– allows direct command entry

– Sometimes implemented in kernel, sometimes by systems program

– Sometimes multiple flavors implemented – shells

– Primarily fetches a command from user and executes it

• Graphical user interface– User-friendly desktop metaphor interface

• Many systems now include both CLI and GUI interfaces

Page 5: Chap 2 System Structures. Operating System Services One set of operating-system services provides functions that are helpful to the user: –User interface.

System Calls

• Programming interface to the services provided by the OS

• Mostly accessed by programs via a high-level Application Program Interface (API) rather than direct system call use

• Three most common APIs are Win32 API for Windows, POSIX API for POSIX-based systems (including UNIX, Linux, and Mac OS X), and Java API for the Java virtual machine (JVM)

Page 6: Chap 2 System Structures. Operating System Services One set of operating-system services provides functions that are helpful to the user: –User interface.

Example of System Calls

• System call sequence to copy the contents of one file to another file

Page 7: Chap 2 System Structures. Operating System Services One set of operating-system services provides functions that are helpful to the user: –User interface.

Example of Standard API

• Consider the ReadFile() function in the• Win32 API—a function for reading from a file

Page 8: Chap 2 System Structures. Operating System Services One set of operating-system services provides functions that are helpful to the user: –User interface.

System Call Implementation

• Typically, a number associated with each system call– System-call interface maintains a table indexed according

to these numbers

• The system call interface invokes intended system call in OS kernel and returns status of the system call and any return values

• The caller need know nothing about how the system call is implemented– Just needs to obey API and understand what OS will do as a

result call

Page 9: Chap 2 System Structures. Operating System Services One set of operating-system services provides functions that are helpful to the user: –User interface.

API – System Call – OS Relationship

Page 10: Chap 2 System Structures. Operating System Services One set of operating-system services provides functions that are helpful to the user: –User interface.

Standard C Library Example

• C program invoking printf() library call, which calls write() system call

Page 11: Chap 2 System Structures. Operating System Services One set of operating-system services provides functions that are helpful to the user: –User interface.

System Call Parameter Passing

• Three general methods used to pass parameters to the OS– Simplest: pass the parameters in registers– Parameters stored in a block, or table, in memory, and

address of block passed as a parameter in a register • This approach taken by Linux and Solaris

– Parameters placed, or pushed, onto the stack by the program and popped off the stack by the operating system

– Block and stack methods do not limit the number or length of parameters being passed

Page 12: Chap 2 System Structures. Operating System Services One set of operating-system services provides functions that are helpful to the user: –User interface.

Parameter Passing via Table

Page 13: Chap 2 System Structures. Operating System Services One set of operating-system services provides functions that are helpful to the user: –User interface.

Types of System Calls

• Process control– end, abort– load, execute– create process, terminate process– get process attributes , set process attributes– wait for time– wait event, signal event– allocate and free memory

• File management– create file, delete file, open,Close– read, write, reposition– get file attributes, set file attributes

Page 14: Chap 2 System Structures. Operating System Services One set of operating-system services provides functions that are helpful to the user: –User interface.

Types of System Calls

• Device management– request device, release device– read, write, reposition– get device attributes, set device attributes– logically attach or detach devices

• Information maintenance– Communications may be via shared memory or through

message passing (using mailbox)– get time or date, set time or date– get system data, set system data– get process, file, or device attributes– set process, file, or device attributes

Page 15: Chap 2 System Structures. Operating System Services One set of operating-system services provides functions that are helpful to the user: –User interface.

Types of System Calls

• Communications– create, delete communication connection– send, receive messages– transfer status information– attach or detach remote devices

Page 16: Chap 2 System Structures. Operating System Services One set of operating-system services provides functions that are helpful to the user: –User interface.

System Programs

• System programs provide a convenient environment for program development and execution. The can be divided into:– File manipulation

– Status information

– File modification

– Programming language support

– Program loading and execution

– Communications

– Application programs

Page 17: Chap 2 System Structures. Operating System Services One set of operating-system services provides functions that are helpful to the user: –User interface.

Operating System Structure

• MS-DOS – written to provide the most functionality in the least space

Page 18: Chap 2 System Structures. Operating System Services One set of operating-system services provides functions that are helpful to the user: –User interface.

Operating System Structure

• Layered Approach– The operating system is divided into a number of layers

(levels). The bottom layer (layer 0), is the hardware; the highest (layer N) is the user interface.

– With modularity, layers are selected such that each uses functions and services of only lower-level layers

Page 19: Chap 2 System Structures. Operating System Services One set of operating-system services provides functions that are helpful to the user: –User interface.

Operating System Structure

• UNIX – limited by hardware functionality, the original UNIX operating system had limited structuring. 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

Page 20: Chap 2 System Structures. Operating System Services One set of operating-system services provides functions that are helpful to the user: –User interface.

Operating System Structure

• UNIX System Structure

Page 21: Chap 2 System Structures. Operating System Services One set of operating-system services provides functions that are helpful to the user: –User interface.

Operating System Structure

• Solaris Modular Approach

Page 22: Chap 2 System Structures. Operating System Services One set of operating-system services provides functions that are helpful to the user: –User interface.

Virtual Machines

• A virtual machine takes the layered approach to its logical conclusion. It treats hardware and the operating system kernel as though they were all hardware

• A virtual machine provides an interface identical to the underlying bare hardware

• The operating system creates the illusion of multiple processes, each executing on its own processor with its own (virtual) memory

Page 23: Chap 2 System Structures. Operating System Services One set of operating-system services provides functions that are helpful to the user: –User interface.

Virtual Machines (Cont.)

• The resources of the physical computer are shared to create the virtual machines– CPU scheduling can create the appearance that users

have their own processor

– Spooling and a file system can provide virtual card readers and virtual line printers

– A normal user time-sharing terminal serves as the virtual machine operator’s console

Page 24: Chap 2 System Structures. Operating System Services One set of operating-system services provides functions that are helpful to the user: –User interface.

Virtual Machines (Cont.)

(a) Nonvirtual machine (b) virtual machine