-
8/13/2019 Lecture 3 Process Management Operating-System Structures
1/36
Lecture 3: Process Management/
Operating-System Structures
System Components
Operating System Services
System Calls
System Programs
System Structure
Virtual Memory
Virtual Machines
System Design and Implementation
System Generation
-
8/13/2019 Lecture 3 Process Management Operating-System Structures
2/36
Common System Components
Process Management
Main Memory Management
Secondary-Storage Management
I/O System Management
File Management
Protection System
Networking
Command-Interpreter System
-
8/13/2019 Lecture 3 Process Management Operating-System Structures
3/36
Process Management
Aprocessis a program in execution. A process needscertain resources, including CPU time, memory, files,and I/O devices, to accomplish its task.
The operating system is responsible for the followingactivities in connection with process management.
Process creation and deletion.
process suspension and resumption.
Provision of mechanisms for:
process synchronization
process communication
-
8/13/2019 Lecture 3 Process Management Operating-System Structures
4/36
Main-Memory Management
Memory is a large array of words or bytes, each with itsown address. It is a repository of quickly accessibledata shared by the CPU and I/O devices.
Main memory is a volatile storage device. It loses its
contents in the case of system failure. The operating system is responsible for the following
activities in connections with memory management: Keep track of which parts of memory are currently being
used and by whom.
Decide which processes to load when memory spacebecomes available.
Allocate and deallocate memory space as needed.
-
8/13/2019 Lecture 3 Process Management Operating-System Structures
5/36
-
8/13/2019 Lecture 3 Process Management Operating-System Structures
6/36
I/O System Management
The I/O system consists of:
A buffer-caching system
A general device-driver interface
Drivers for specific hardware devices
-
8/13/2019 Lecture 3 Process Management Operating-System Structures
7/36
File Management
A file is a collection of related information defined byits creator. Commonly, files represent programs (bothsource and object forms) and data.
The operating system is responsible for the followingactivities in connections with file management:
File creation and deletion.
Directory creation and deletion.
Support of primitives for manipulating files and directories.
Mapping files onto secondary storage.
File backup on stable (nonvolatile) storage media.
-
8/13/2019 Lecture 3 Process Management Operating-System Structures
8/36
Protection System
Protectionrefers to a mechanism for
controlling access by programs, processes, or
users to both system and user resources.
The protection mechanism must:
distinguish between authorized and unauthorized
usage.
specify the controls to be imposed.
provide a means of enforcement.
-
8/13/2019 Lecture 3 Process Management Operating-System Structures
9/36
Networking (Distributed Systems)
A distributedsystem is a collection processorsthat do not share memory or a clock. Eachprocessor has its own local memory.
The processors in the system are connectedthrough a communication network.
A distributed system provides user access tovarious system resources.
Access to a shared resource allows: Computation speed-up
Increased data availability
Enhanced reliability
-
8/13/2019 Lecture 3 Process Management Operating-System Structures
10/36
Command-Interpreter System
Many commands are given to the operatingsystem by control statements which deal with:
process creation and management
I/O handling secondary-storage management
main-memory management
file-system access protection
networking
-
8/13/2019 Lecture 3 Process Management Operating-System Structures
11/36
Command-Interpreter System (Cont.)
The program that reads and interprets control
statements is called variously:
control-card interpreter
command-line interpreter
shell (in UNIX)
Its function is to get and execute the next
command statement.
-
8/13/2019 Lecture 3 Process Management Operating-System Structures
12/36
Operating System Services
Program executionsystem capability to load a program intomemory and to run it.
I/O operations since user programs cannot execute I/Ooperations directly, the operating system must provide some meansto perform I/O.
File-system manipulationprogram capability to read, write,create, and delete files.
Communicationsexchange of information between processesexecuting either on the same computer or on different systems tiedtogether by a network. Implemented via shared memoryormessage passing.
Error detectionensure correct computing by detecting errors inthe CPU and memory hardware, in I/O devices, or in user programs.
-
8/13/2019 Lecture 3 Process Management Operating-System Structures
13/36
Additional Operating System Functions
Additional functions exist not for helping the user,
but rather for ensuring efficient system operations.
Resource allocationallocating resources to multipleusers or multiple jobs running at the same time.
Accountingkeep track of and record which users usehow much and what kinds of computer resources for
account billing or for accumulating usage statistics.
Protectionensuring that all access to systemresources is controlled.
-
8/13/2019 Lecture 3 Process Management Operating-System Structures
14/36
System Calls
System calls provide the interface between a runningprogram and the operating system. Generally available as assembly-language instructions.
Languages defined to replace assembly language for
systems programming allow system calls to be madedirectly (e.g., C. Bliss, PL/360)
Three general methods are used to pass parametersbetween a running program and the operating system. Pass parameters in registers.
Store the parameters in a table in memory, and the tableaddress is passed as a parameter in a register.
Push(store) the parameters onto the stackby theprogram, andpopoff the stack by operating system.
-
8/13/2019 Lecture 3 Process Management Operating-System Structures
15/36
Passing of Parameters As A Table
-
8/13/2019 Lecture 3 Process Management Operating-System Structures
16/36
MS-DOS Execution
At System Start-up Running a Program
-
8/13/2019 Lecture 3 Process Management Operating-System Structures
17/36
UNIX Running Multiple Programs
-
8/13/2019 Lecture 3 Process Management Operating-System Structures
18/36
Communication Models
Msg Passing Shared Memory
-
8/13/2019 Lecture 3 Process Management Operating-System Structures
19/36
System Programs
System programs provide a convenient environmentfor program development and execution. The can bedivided into: File manipulation
Status information
File modification
Programming language support
Program loading and execution
Communications
Application programs
Most users view of the operation system is defined bysystem programs, not the actual system calls.
-
8/13/2019 Lecture 3 Process Management Operating-System Structures
20/36
-
8/13/2019 Lecture 3 Process Management Operating-System Structures
21/36
MS-DOS Layer Structure
-
8/13/2019 Lecture 3 Process Management Operating-System Structures
22/36
System StructureSimple Approach
(Cont.)
UNIXlimited by hardware functionality, theoriginal UNIX operating system had limitedstructuring. The UNIX OS consists of two
separable parts. Systems programs
The kernel
Consists of everything below the system-call interface andabove the physical hardware
Provides the file system, CPU scheduling, memorymanagement, and other operating-system functions; a largenumber of functions for one level.
-
8/13/2019 Lecture 3 Process Management Operating-System Structures
23/36
UNIX System Structure
-
8/13/2019 Lecture 3 Process Management Operating-System Structures
24/36
System StructureLayered Approach
The operating system is divided into a number
of layers (levels), each built on top of lower
layers. The bottom layer (layer 0), is the
hardware; the highest (layer N) is the userinterface.
With modularity, layers are selected such that
each uses functions (operations) and servicesof only lower-level layers.
-
8/13/2019 Lecture 3 Process Management Operating-System Structures
25/36
An Operating System Layer
-
8/13/2019 Lecture 3 Process Management Operating-System Structures
26/36
Layered Structure of the THE OS
A layered design was first used in THE operating system.Its six layers are as follows:
layer 5: user programs
layer 4: buffering for input and outputlayer 3: operator-console device driver
layer 2: memory management
layer 1: CPU scheduling
layer 0: hardware
-
8/13/2019 Lecture 3 Process Management Operating-System Structures
27/36
OS/2 Layer Structure
-
8/13/2019 Lecture 3 Process Management Operating-System Structures
28/36
Virtual Memory
Virtual memory is a memory management technique that isimplemented using both hardware and software. Itmaps memory addresses used by a program, called virtualaddresses, into physical addresses in computer memory.
Main storage as seen by a process or task appears as a
contiguous address space or collection ofcontiguous segments. The operating system managesvirtual address spaces and the assignment of real memoryto virtual memory.
Address translation hardware in the CPU, often referred to
as a memory management unit or MMU, automaticallytranslates virtual addresses to physical addresses.
-
8/13/2019 Lecture 3 Process Management Operating-System Structures
29/36
Virtual Machines
A virtual machinetakes the layered approachto its logical conclusion. It treats hardwareand the operating system kernel as though
they were all hardware. A virtual machine provides an interface
identicalto the underlying bare hardware.
The operating system creates the illusion ofmultiple processes, each executing on its ownprocessor with its own (virtual) memory.
-
8/13/2019 Lecture 3 Process Management Operating-System Structures
30/36
-
8/13/2019 Lecture 3 Process Management Operating-System Structures
31/36
System Models
Non-virtual Machine Virtual Machine
-
8/13/2019 Lecture 3 Process Management Operating-System Structures
32/36
Advantages/Disadvantages of Virtual Machines
The virtual-machine concept provides complete protectionof system resources since each virtual machine is isolatedfrom all other virtual machines. This isolation, however,permits no direct sharing of resources.
A virtual-machine system is a perfect vehicle for operating-systems research and development. System developmentis done on the virtual machine, instead of on a physicalmachine and so does not disrupt normal system operation.
The virtual machine concept is difficult to implement dueto the effort required to provide an exactduplicate to theunderlying machine.
-
8/13/2019 Lecture 3 Process Management Operating-System Structures
33/36
System Design Goals
User goalsoperating system should be
convenient to use, easy to learn, reliable, safe,
and fast.
System goalsoperating system should be
easy to design, implement, and maintain, as
well as flexible, reliable, error-free, and
efficient.
-
8/13/2019 Lecture 3 Process Management Operating-System Structures
34/36
Mechanisms and Policies
Mechanisms determine how to do something,
policies decide what will be done.
The separation of policy from mechanism is a
very important principle, it allows maximum
flexibility if policy decisions are to be changed
later.
-
8/13/2019 Lecture 3 Process Management Operating-System Structures
35/36
System Implementation
Traditionally written in assembly language,operating systems can now be written in higher-level languages.
Code written in a high-level language: can be written faster.
is more compact.
is easier to understand and debug.
An operating system is far easier toport(move tosome other hardware) if it is written in a high-level language.
-
8/13/2019 Lecture 3 Process Management Operating-System Structures
36/36