OSes: 3. OS Structs 1 Operating Systems v Objectives –summarise OSes from several perspectives Certificate Program in Software Development CSE-TC and CSIM, AIT September -- November, OS Structures (Ch. 3, S&G)
OSes: 3. OS Structs 2 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 3 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 Process/thread Mgmt. v Programs are passive v Processes execute, each with its own program counter, but shared resources v Threads are light-weight processes –much simpler state and control continued
OSes: 3. OS Structs 5 v Management tools: –creation/deletion –suspension/resumption –synchronisation –communication –resource allocation/release –deadlock handling
OSes: 3. OS Structs Main Memory Mgmt. v Depends on system and hardware support v Track memory usage v Decide on process scheduling v Allocate/deallocate memory to jobs
OSes: 3. OS Structs Secondary Storage Mgmt. v Storage and retrieval v Scheduling v Free space management v Efficient usage is essential
OSes: 3. OS Structs I/O System Mgmt. v Aim: hide device peculiarities v Features: –buffering, caching, spooling –support an abstract interface to devices –support a range of specific devices
OSes: 3. OS Structs File Mgmt. v Many types of file systems, with different properties: –speed, capacity, data transfer rate, access method (e.g. sequential, random) v Aim: provide a consistent, logical view: –files and directories continued
OSes: 3. OS Structs 10 v Features: –creation/deletion of files & directories –manipulation u open, close u read, write, seek u get/set attributes –mapping to physical storage –backup/archiving
OSes: 3. OS Structs Protection/Security v Protection: controlling the access of programs, processes, or users to the system’s resources –e.g. CPU, files, peripherials v Network aspects of protection are becoming increasingly important
OSes: 3. OS Structs Networking v Main machine types: –multiprocessor systems –distributed systems v Two main communication models: –message passing –shared memory continued
OSes: 3. OS Structs 13 Communication Models Fig. 3.5, p.66 process A M process B M kernel M 1 2 Message Passing process A process B shared memory 1 2 kernel Shared memory
OSes: 3. OS Structs OS Services v User services: –program execution; I/O operations; file manipulation; communication; error detection v System efficiency: –resource allocation; accounting; protection
OSes: 3. OS Structs System Calls v Process control v File manipulation v Device manipulation v Information maintenance v Communications
OSes: 3. OS Structs System Structure v UNIX (fig. 3.7, p.70) system call interface to kernel kernel interface to the kernel signals terminal handling character I/O system terminal drivers file system swapping block I/O system disk and tape drivers CPU scheduling page replacement demand paging virtual memory terminal controllers terminals device controllers disks and tapes memory controllers physical memory shells and commands compilers and interpreters system libraries USERS
OSes: 3. OS Structs 17 Layered Approach Fig. 3.8, p.71 layer M-1 : hidden operations layer M existing operations new operations : :
OSes: 3. OS Structs 18 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 Virtual Machines v A virtual machine supplies a set of ‘system’ calls that support a machine in software –it rests on top of the underlying physical hardware v A virtual machine may be different from the underlying hardware.
OSes: 3. OS Structs 20 Issues v The hardware places limits on the virtual machine’s functionality –e.g. the number/type of peripherals v How to support virtual user and monitor modes in physical user mode? v Speed
OSes: 3. OS Structs 21 Advantages v A virtual machine can protect physical system resources v Portability v Research/development
OSes: 3. OS Structs 22 Disadvantages v Difficult to implement a fast system. v Hard to support modes. v Speed issues may require simulation and/or direct access to the underlying OS or hardware.
OSes: 3. OS Structs OS Design & Implementation v 6.1. Design Goals –user and system design goals may conflict –goal tend to be vague u e.g. easy to use, easy to implement
OSes: 3. OS Structs Mechanisms & Policies v Separate policy from mechanism –policy: what will be done –mechanism: how to do it v Example: CPU protection –mechanism: timer –policy: timer period v Flexibility v Micro-kernels vs. monoliths
OSes: 3. OS Structs Implementation v Assembly language vs. high-level languages v Example: UNIX is coded in C but for ~900 lines of assembler for the scheduler and device drivers