21
Operating System Structure • Introduction of Topics – OS Components – OS Services – System Calls – System Programs – Different types of System Structure – Virtual Machines – System Design and Implementation

Operating System Structure Introduction of Topics –OS Components –OS Services –System Calls –System Programs –Different types of System Structure –Virtual

Embed Size (px)

Citation preview

Operating System Structure

• Introduction of Topics– OS Components – OS Services– System Calls– System Programs– Different types of System Structure– Virtual Machines– System Design and Implementation

OS Components

• Process Management

• Main-Memory Management

• Secondary-Storage Management

• I/O System Management

• File Management

• Protection System

• Networking

• Command-Interpreter System

Process Management• Program - static entity

• Process - active entity – a process is a program in execution with its current

values (PC, other registers, variable values, status flags)

• Processes require resources (memory, CPU, I/O)

• OS is responsible for:– creation/deletion of user and system processes– suspension and resumption of processes– provisions and mechanisms for process

synchronization, communication and deadlock handling

Main-memory Management

• Main memory is generally the only storage that the CPU directly addresses

• The OS must provide means for– mapping program logical addresses to memory

physical (or absolute) addresses– allocating and deallocating memory for processes– keeping track of which parts of memory are being

used by which processes– which processes should be loaded into memory when

space becomes available and which processes should be removed when space is needed

Secondary-storage and I/O Management

• OS is responsible for the following storage activities:– Free-space management– Storage allocation– Disk scheduling

• OS is responsible for the following I/O activities:– Device driver communications– Device driver installation– Resource allocation and management

File Management

• The OS is responsible for the following file activities:– creation/deletion of files– creation/deletion of directories– support of primitives for manipulating files and

directories (including editors)– mapping of files onto secondary storage– automatic backup of files

Protection

• Concurrent processes must be protected from each other– processes must gain proper authorization to

use/access files, memory, CPU, other resources– memory-addressing hardware ensures that a

process can only access its own address space– timer ensures that a process will eventually

relinquish the CPU– users are not allowed to directly perform I/O and

therefore the OS directly protects against unauthorized I/O

Networking

• A distributed system is a collection of processors that do not share memory or a clock

• Processors communicate to each other through communications lines – high-speed bus, telephone, network lines, etc

• OS manages network communications and possibly all network resources depending on the type of network

Command-Interpretation

• Interface between the user and the OS

• Some OS’s have this ability within the OS kernel, others (MS-DOS) use special programs

• Modern OS’s use a user-friendly interpreter in the form of a GUI (graphical user interface)

• Commands deal with all aspects of the OS

OS Services• Program execution• I/O operations• File-system manipulation• Interprocess Communications• Error detection• Resource Allocation• Accounting• Protection/Security

System Calls• Provide the interface between the program and

OS– Available in assembly & machine instruction sets– Might be available in high level languages (like C)

• System Calls will require parameters so that the OS can determine specifics

– such as what input device should be read from

• Three means of parameter passing: – through registers

– through a block of memory reserved

– through a stack

– 5 categories of system calls • process control, file manipulation, device manipulation, info

maintenance and communications

Process Control

• End or Abort – normal vs abnormal termination – includes performing memory dump or process trace

• Process initiation– Load, execute, create, terminate

• Get and set process attributes

• Wait for time or wait for event, signal an event– timer, traps and interrupts

• Allocate and free memory for process

File and Device Manipulation

– Create, delete files– Open, close files– Read, write, reposition file marker– Get or set file attributes– Request device, release device– Read, write, reposition device marker– Get or set device attributes– Logically attach or detach device

Information and Communication

– Get or set time or date– Get or set system data– Get or set process, file, device attribute– Create or delete communication connection– Send, receive messages– Transfer status information– Attach or detach remote devices

System Programs

– File manipulation• create, delete, copy, rename,

print, dump, list

– Status information• date, time, available

memory, disk capacity, # of users

– File modification• editors and others

– Programming support• compilers, assemblers,

interpreters for common languages

– Program loading• loaders, linkers, debuggers

– Communications• interprocess communication,

user communication

– Command-line interpreter

– Applications programs

Simple System Structure

• OS’s that start small with no well-defined structure but are later enhanced – e.g., MS-DOS or the original Unix)

• MS-DOS is essentially a resident system program and device drivers

• Original Unix consisted of a kernel and the systems programs where the kernel contained the various device drivers and interfaces)

– See figures 3.6 and 3.7, pages 69-70

Layered Approaches

• A layered approach gives implementers more freedom in the inner workings of a system without affecting the OS or user applications– Overall functionality and features are separated into

distinct components– Information hiding and modularity (two fundamentals

of programming) can be achieved • Examples include THE OS (figure 3.9) and Venus OS

(figure 3.10) pages 72-73.

Virtual Machines• Conceptually, a computer is made up of layers:

– hardware, kernel, OS, user interface, applications, user

• A virtual machine can be created by allowing applications programs to directly call and control systems programs – The application programs view everything underneath

them as part of the hardware which allows for a uniform interface among all components

– This allows for easy: • Multitasking

• Virtual Memory

– File handling is a problem

Benefits of VM implementation

• Environment is protected from system resources

• No security problems (VM is isolated)

• Useful for OS research and development

• Allows for emulation of other types of machines (e.g., running MS-DOS on a Sun workstation or Windows on a Macintosh)

Java• Java is implemented by a compiler that

generates bytecode output which are instructions that run on a Java VM

• Each platform (IBM, Mac, Sun, etc…) has its own JVM implementation (the JVM is actually an interpreter)

• This allows source code to be transported over the internet and executed no matter what the machine is

• Has built-in security to disallow unsafe and unsecure operations

OS Design and Implementation

• Design Goals - type of OS - batch, time-shared, single- vs multi-user, distributed, real-time, etc...

• Mechanisms and Policies - separation of how things will be done and what will be done

• Implementation - assembly language, C, lisp

• Generation - configuration of the OS to the hardware -- what CPU will be used? how much memory is available? what devices are available?