Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 25

Operating Systems

Certificate Program in Software Development


CSE-TC and CSIM, AIT
September -- November, 2003

3. OS Structures
(Ch. 3, S&G)

 Objectives
– summarise OSes from several perspectives

OSes: 3. OS Structs 1
Contents
1. OS Components
2. OS Services
3. System Calls
4. System Structure
5. Virtual Machines
6. OS Design and Implementation

OSes: 3. OS Structs 2
1. OS Components
1.1. Process/thread Management
1.2. Main Memory Management
1.3. Secondary Storage Management
1.4. I/O System Management
1.5. File Management
1.6. Protection/Security
1.7. Networking

OSes: 3. OS Structs 3
1.1. Process/thread Mgmt.

 Programs are passive

 Processes execute, each with its own


program counter, but shared resources

 Threads are light-weight processes


– much simpler state and control

OSes: 3. OS Structs continued 4


 Management tools:
– creation/deletion
– suspension/resumption
– synchronisation
– communication
– resource allocation/release
– deadlock handling

OSes: 3. OS Structs 5
1.2. Main Memory Mgmt.

 Depends on system and hardware support

 Track memory usage

 Decide on process scheduling

 Allocate/deallocate memory to jobs

OSes: 3. OS Structs 6
1.3. Secondary Storage Mgmt.

 Storage and retrieval

 Scheduling

 Free space management

 Efficient usage is essential

OSes: 3. OS Structs 7
1.4. I/O System Mgmt.

 Aim: hide device peculiarities

 Features:
– buffering, caching, spooling
– support an abstract interface to devices
– support a range of specific devices

OSes: 3. OS Structs 8
1.5. File Mgmt.

 Many types of file systems, with different


properties:
– speed, capacity, data transfer rate,
access method (e.g. sequential, random)

 Aim: provide a consistent, logical view:


– files and directories

OSes: 3. OS Structs continued 9


 Features:
– creation/deletion of files & directories
– manipulation
 open, close
 read, write, seek
 get/set attributes
– mapping to physical storage
– backup/archiving

OSes: 3. OS Structs 10
1.6. Protection/Security

 Protection: controlling the access of


programs, processes, or users to the
system’s resources
– e.g. CPU, files, peripherials

 Network aspects of protection are


becoming increasingly important

OSes: 3. OS Structs 11
1.7. Networking

 Main machine types:


– multiprocessor systems
– distributed systems

 Two main communication models:


– message passing
– shared memory

OSes: 3. OS Structs continued 12


Communication Models Fig. 3.5, p.66

Message Passing Shared memory

process A M process A 1
1

process B M process B
2
2
shared memory

kernel M kernel

OSes: 3. OS Structs 13
2. OS Services

 User services:
– program execution; I/O operations;
file manipulation; communication;
error detection

 System efficiency:
– resource allocation; accounting;
protection

OSes: 3. OS Structs 14
3. System Calls

 Process control
 File manipulation
 Device manipulation
 Information maintenance
 Communications

OSes: 3. OS Structs 15
4. System Structure
 UNIX (fig. 3.7, p.70)

USERS
shells and commands
compilers and interpreters
system libraries
system call interface to kernel
signals file system CPU scheduling
terminal handling swapping page replacement
character I/O system block I/O system demand paging
terminal drivers disk and tape drivers virtual memory
kernel interface to the kernel
terminal controllers device controllers memory controllers
terminals disks and tapes physical memory

OSes: 3. OS Structs 16
Layered Approach Fig. 3.8, p.71

new layer M
operations :
layer M-1
hidden :
operations

existing
operations :

OSes: 3. OS Structs 17
THE Layer Structure

layer 5: user programs


layer 4: buffering for I/O devices
layer 3: operator-console device drivers
layer 2: memory management
layer 1: CPU scheduling
layer 0: hardware

OSes: 3. OS Structs 18
5. Virtual Machines

 A virtual machine supplies a set of ‘system’


calls that support a machine in software
– it rests on top of the underlying physical
hardware

 A virtual machine may be different from the


underlying hardware.

OSes: 3. OS Structs 19
Issues

 The hardware places limits on the virtual


machine’s functionality
– e.g. the number/type of peripherals

 How to support virtual user and monitor


modes in physical user mode?

 Speed
OSes: 3. OS Structs 20
Advantages

 A virtual machine can protect physical


system resources

 Portability

 Research/development

OSes: 3. OS Structs 21
Disadvantages

 Difficult to implement a fast system.

 Hard to support modes.

 Speed issues may require simulation and/or


direct access to the underlying OS or hardw
are.

OSes: 3. OS Structs 22
6. OS Design & Implementation

 6.1. Design Goals


– user and system design goals may conflict

– goal tend to be vague


 e.g. easy to use, easy to implement

OSes: 3. OS Structs 23
6.2. Mechanisms & Policies
 Separate policy from mechanism
– policy: what will be done
– mechanism: how to do it
 Example: CPU protection
– mechanism: timer
– policy: timer period
 Flexibility
 Micro-kernels vs. monoliths
OSes: 3. OS Structs 24
6.3. Implementation

 Assembly language vs. high-level


languages

 Example: UNIX is coded in C but for


~900 lines of assembler for the scheduler
and device drivers

OSes: 3. OS Structs 25

You might also like