Operating System Structures - Operating System - Lecture Slides, Slides for Computer Science. All India Institute of Medical Sciences

Computer Science

Description: These are the Lecture Slides of Operating System which includes Environment, Fundamental Goal, Programs, Time Line, User Programs, Versus, Operating System, Running, Symmetric Multiprocessing etc.Key important points are: Operating System Structures, Interface Provided, Programmer Access, Programmers, System Calls, User Level Access, Services, Layered Approach, Operating System, Data Types
Showing pages  1  -  2  of  30
The preview of this document ends here! Please or to read the full document or to download it.
Document information
Embed this document:
PowerPoint Presentation


Chapter 2: Operating-System Structures

• Operating system design • Interface provided to users & programmers

– System calls (programmer access) – User level access to system

• Services



System Structure • Layered approach

– Operating system divided into layers – Higher levels use only services of lower levels – Basic principle of abstract data types (classes)

Figure 2.14 Docsity.com


Mechanism vs. Policy • Mechanisms determine how to do something

– Provided by the operating system – E.g., ability to set the priority of a user process

• Policies determine what will be done – E.g., determining which processes get highest priority

• Separation gives flexibility • Solaris example p. 67

– CPU scheduling controlled by loadable tables – These tables provide a general purpose mechanism for

scheduling – The policy is determined by the specific table loaded – E.g., different tables can provide time-sharing, batch

processing or real-time scheduling





FreeList BlockGroup




Original Unix O/S: Kernel Approach

Figure 2.13, p. 69 “monolithic structure” Docsity.com


Monolithic Structure

• “an enormous amount of functionality … combined into one level [of abstraction in software]” (p. 69, Our text-- Silberschatz et al.)

• “… this approach might well be subtitled ‘The Big Mess.’ The structure is that there is no structure. The operating system is written as a collection of procedures, each of which can call any of the other ones whenever it wants to.” (p. 56, Tanenbaum, 2001, Modern Operating Systems, 2nd Ed).



Microkernel Approach • More like a client-server system • Kernel supports efficient message passing

– Plus some other low-level services such as interrupt handling, loading device drivers

• Much of former kernel runs in user mode (not kernel mode) – E.g., file system (server) may run in user mode

• Mach (some versions), and QNX (http://www.qnx.com/) operating systems organized this way

• QNX is real-time; small (micro) kernel can be advantageous to real-time systems Docsity.com

8 http://en.wikipedia.org/wiki/Microkernel Docsity.com

Alternate View of Microkernel


device driver



Mac OS X: “Microkernel” Approach (not fully)

Figure 2.16

Emphasis: Mach and BSD Unix both run in kernel mode



Solaris: Modular approach

• “Perhaps the best current methodology for operating-system design involves using object- oriented programming techniques to create a modular kernel” (p. 72)

• modules are typically dynamically loadable (e.g., Solaris, Linux, Mac OS X)

Fig 2.15


Machine Code of a Typical Process Running on an Operating System

12 etc.

top of process in RAM (low numbered addresses)

bottom of process in RAM (low numbered addresses)

Machine instructions executed in user mode

System call


Process Interfaces to the System

• In what we’ve been talking about so far, a process can either execute machine language code or it can make system calls

• What other kinds of process interfaces are possible?

• API or library interfaces; e.g., POSIX • Virtual machine interface

13 Docsity.com


Virtual Machines

• Processes provided with an interface virtually identical to the bare hardware

• Each process is provided with a (virtual) copy of the underlying computer

• E.g., IBM VM mainframe operating system • Devices are an issue

– e.g., Disks must be partitioned • Each user runs an operating system on their own

virtual machine – Some instructions run directly on hardware – Some instructions (e.g., I/O) are interpreted



Figure 2.17: Virtual & Non-Virtual Machines

Non-virtual Machine Virtual Machine


Hosted Virtual Machine

16 Docsity.com


Java Virtual Machine (JVM)

• Specification for an abstract computer – http://java.sun.com/docs/books/jvms/ – http://java.sun.com/docs/books/jvms/second_edition/html/VMSpecTOC.doc.html

• Instructions specified as “bytecode”s • Architecture neutral • Java program code is compiled (javac) into files

containing bytecode • JVM includes

– Class loader – Bytecode verifier – Bytecode interpreter




• User interface • Program execution: Processes • Resource allocation • I/O operations • File-system manipulation • Communications • Protection & security • Error detection • Accounting

Figure 2.1, p. 48 of text


Services - 1 • User Interface

– GUI and command line are the most common for general purpose operating systems

• Program execution – System must be able to load a machine language

program into RAM memory and run that program

• Resource allocation – Multiple processes or users: Need to share, allocate,

and manage resources – Examples of types of resources: CPU cycles (time),

main memory, disk files, I/O devices (printers, USB flash drives etc).

20 Docsity.com

Services - 2 • I/O operations

– All I/O that a program does is typically carried out by the O/S

– This is for efficiency and protection • File-system manipulation

– creating, reading, writing files & directories • Communications

– Between processes on the same computer and between processes across different computers

– e.g., Shared memory & message passing

21 Docsity.com

Services - 3 • Protection & security

– In multiuser systems, some people want to control access to their information

– Generally, “when several separate processes execute concurrently, it should not be possible for one process to interfere with others or with the operating system itself” (p. 49)

• Error detection – OS “needs be constantly aware of possible errors” (p. 49) – Hardware errors include: power, memory, device errors – Software errors include: divide by 0, access of an illegal

memory location • Accounting

– Which processes/users use which resources and for how long? – For statistics or for billing, and possibly for imposing resource

limits 22 Docsity.com


What is a system call?

• A means for application programs to access operating system kernel functionality

• Types of calls – Process control: E.g., create, load, execute – File operations: E.g., create, open, read, write – Device manipulation: E.g., request, read, write – Information: E.g., get or set process attributes – Communications: E.g., create connection, send or

receive message



Figure 1.10: Transition from User to Kernel Mode



System Call Implementation • For example? E.g., file open, close, read or write ①Software interrupt CPU instruction is executed e.g., Intel x86 and MIPS: syscall instruction (others on

Intel: sysenter, int 0x80) ②Execution control passes to an interrupt service routine in

O/S; context switch is required ③CPU mode bit is set to monitor (kernel) mode ④Parameters

• Software interrupt parameters may give type of system call (e.g., read or write), or may be given as as system call parameters

• Parameters to system call passed in registers, in a block of data, or user stack

⑤System call is executed • E.g., kernel code runs • Process is executing kernel code for duration of system call

⑥Process is resumed (return from interrupt), back in user mode; context switch is required



Procedure Calls vs. System Calls

Operating system

System call Return value(s)

User process


User process


Procedure call is within the user process address space


Making a System Call in Linux

• http://www.ibm.com/developerworks/linux/li brary/l-system-calls/

• http://www.linuxjournal.com/article/4048?pa ge=0,1

• http://www.win.tue.nl/~aeb/linux/lk/lk-3.html • http://stackoverflow.com/questions/344829/what-is-

kernel-vsyscall • http://stackoverflow.com/questions/9977968/adding-


29 Docsity.com

System calls have numbers

30 Docsity.com

A system call from C

#include <stdlib.h> int main() {

exit(42); }

31 Docsity.com

Making a system call from assembly language

32 See also http://www.win.tue.nl/~aeb/linux/lk/lk-3.html Docsity.com


System Programs

• How does a system program differ from a system call? • System program: Application programs that provide

system related services – Use operating system calls to provide operating system related

functionality – Run in user mode (not kernel mode)

• Examples of system programs – Network communications such as http servers (e.g., apache) – Compilers (e.g., g++) – File management: directory listing (ls on Unix), copying files

(cp on Unix) – User interface (X11, Gnome)


Docsity is not optimized for the browser you're using. In order to have a better experience please switch to Google Chrome, Firefox, Internet Explorer 9+ or Safari! Download Google Chrome