Oprting System (Lecture) - Chapter-01

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

Chapter 1

Introduction
1.1 What is an operating system
1.2 History of operating systems
1.3 The operating system zoo
1.4 Computer hardware review
1.5 Operating system concepts
1.6 System calls
1.7 Operating system structure

1
Introduction

• A computer system consists of


– hardware
– system programs
– application programs

2
What is an Operating System

• It is an extended machine
– Hides the messy details which must be performed
– Presents user with a virtual machine, easier to use

• It is a resource manager
– Each program gets time with the resource
– Each program gets space on the resource

3
History of Operating Systems (1)

Early batch system


– bring cards to 1401
– read cards to tape
– put tape on 7094 which does computing
– put tape on 1401 which prints output

4
History of Operating Systems (2)

• First generation 1945 - 1955


– vacuum tubes, plug boards
• Second generation 1955 - 1965
– transistors, batch systems
• Third generation 1965 – 1980
– ICs and multiprogramming
• Fourth generation 1980 – present
– personal computers

5
History of Operating Systems (3)

• Structure of a typical FMS job – 2nd generation


6
History of Operating Systems (4)

• Multiprogramming system
– three jobs in memory – 3rd generation

7
The Operating System Types
• Mainframe operating systems
• Server operating systems
• Multiprocessor operating systems
• Personal computer operating systems
• Real-time operating systems
• Embedded operating systems
• Smart card operating systems

8
Mainframe operating systems
 In this cases, a user sits at a terminal connected to a
mainframe or minicomputer. Other users are accessing
the same computer through other terminals.
 These users share resources and may exchange
information.
 The operating system in such cases is designed to
maximize resource utilization to assure that all available
CPU time, memory, and I/O are used efficiently and that
no individual user takes more than her fair share

9
Server operating systems
 In still other cases, users sit at workstations
connected to networks of other workstations and
servers
 .These users have dedicated resources at their
disposal, but they also share resources such as
networking and servers—file compute, and print
servers
 . Therefore, their operating system is designed to
compromise between individual usability and
resource utilization
•.
10
Multiprocessor operating systems
 Multiple CPUs are interconnected in to a single
system
 Depending on how they are connected and
what is shared, they are called parallel systems
or multiprocessors
 They require special os for communication and
connectivity among the processors

11
Personal computer operating systems
 The user's view of the computer varies according to the interface
being used
 Most computer users sit in front of a PC, consisting of a monitor,
keyboard, mouse, and system unit.
 Such a system is designed for one user to monopolize its resources
 The goal is to maximize the work (or play) that the user is
performing
 In this case, the operating system is designed mostly for ease of
use, with some attention paid to performance and none
paid to resource utilization—how various hardware and software
resources are shared
 Performance is, of course, important to the user; but rather than
resource utilization, such systems are optimized for the single-user
experience.
12
Real time systems
 A real-time system is a computer system that requires not only that the computing
results be "correct" but also that the results be produced within a specified
deadline period
 Results produced after the deadline has passed, even if correct, may be of no real
value.
 To illustrate, consider an autonomous robot that delivers mail in an office complex.
If its vision-control system identifies a wall after the robot has walked into it,
despite correctly identifying the wall, the system has not met its requirement
 In an interactive desktop computer system, it is desirable to provide a quick
response time to the interactive user, but it is not mandatory to do so .Many
traditional operating-system scheduling algorithms must be modified to meet the
stringent timing deadlin
 Eg. Robots in factory in product packing, loading and unloading ,missile
explosion

.
.
 .

13
…Real time systems
 A multimedia system must be able to handle not only conventional
data, such as text files, programs, and word-processing documents,
but also multimedia data.
 Multimedia data consist of continuous-media data (audio and video)
as well as conventional data
 Continuous-media data—such as frames of video—must be delivered
according to certain time restrictions (for example, 30 frames per
second)
 .The demands of handling continuous-media data require significant
changes in operating system

structure, most notably in memory, disk, and network management

14
Embedded systems
 An embedded system is a computing device that is part of a larger
system in which the presence of a computing device is often not
obvious to the user
 They are designed for specific purpose and have limitted cpu,ram
 They run on computers that control devices like digital
wristwatch,,mobiles,PDA w/c are not thought of as computers
 An embedded product uses a microprocessor (or microcontroller) to
do one task and one task only
 Are used for many applications in which cost, power consumption
and space are critical
 A PC contains or is connected to various embedded products Each
one peripheral has a microcontroller inside it that performs only
one task by loading its application in to the RAM

15
Operating-System Structure
 We can view an operating system from several
vantage points.
 One view focuses on the services that the system
provides
 another, on the interface that it makes available
to users and programmers
• third, on its components and their
interconnections

16
Os structure
(the users)…applications
shells and commands
compilers and interpreters
• :. • system libraries

system-call interface to the kernel


K
signals terminal file system memory mgt CPU scheduling E
handling
R
N
E
L
kernel Interface to the hardware mode

terminal controllers device controllers memory controllers


17
..cont

 For instance, when a user program executes an


I/O operation, it executes a system call that is
trapped to the I/O layer, which calls
the memory-management layer, which in turn calls
the CPU-scheduling layer,
which is then passed to the hardware. At each
layer, the parameters may be
modified, data may need to be passed, and so on

18
Operating-System Operations(pg 72)
 At the very least, we need two separate modes of
operation: user mode and kernel mode (also called
supervisor mode, system mode
 When the computer system is executing on behalf of a
user application, the system is in user mode
 However, when a user application requests a service
from the operating system (via a
system call), it must transition from user to kernel mode to
fulfill the request.
 Whenever a trap or interrupt occurs, the hardware
switches from user mode to kernel mode
(that is, changes the state of the mode bit to 0). 19
….cont
 Thus, whenever the operating
system gains control of the computer, it is in kernel
mode
 The dual mode of operation provides us with the
means for protecting the operating system from
errant users—and errant users from one another
 The hardware allows privileged instructions to be
executed only in kernel mode. If an attempt is
made to execute a privileged instruction in user
mode, the hardware does not execute the
instruction but rather treats it as illegal and traps it
to the operating system. 20
Systems calls
System calls provide the means for a user
program to ask the operating system to
perform tasks reserved for the operating
system on the user program's behalf
In all forms, it is the method used by a process
to request action by the operating system. A
system call usually takes the form of a trap to
a specific location in the interrupt vector
A system call usually takes the form of a trap
to a specific location in the interrupt vector
21
…cont
 Control passes through the interrupt vector to a
service routine in the operating system, and the
mode bit is set to kernel mode
 These errors are normally handled by the operating
system If a user program fails in some way—such
as by making an attempt either to execute an
illegal instruction or to access memory that is not
in the user's address space—then the hardware will
trap to the operating system
 . The trap transfers control through the interrupt
vector to the operating system, just as
an interrupt does 22
…cont
 The system call service routine is a part of the
operating system
 .. The kernel examines the interrupting
instruction to determine what system call has
occurred
 parameter indicates what type of service the
user program is requesting.

23
System call steps
• Example read system call
1. the read library procedure passes the parameters
to the called function
2.Then comes the actual call to the library
procedure w/c puts
3.Then a trap to the os is executed to shift from
the user mode to kernel and start execute call
4.The kernel examines the call numbers and
dispatches to the correct call handler

24
…system call
5. Once the system call handler completes, the
control returns to the user library space proc next
to the instruction that cause the trap returning the
required values

25
System call for file management

26
Computer Hardware Review (1)
Monitor

Bus

• Components of a simple personal computer

27
Computer Hardware Review (2)

(a) A three-stage pipeline


(b) A superscalar CPU

28
Computer Hardware Review (3)

• Typical memory hierarchy


– numbers shown are rough approximations

29
Computer Hardware Review (4)

Structure of a disk drive

30
Computer Hardware Review (5)

One base-limit pair and two base-limit pairs


31
Computer Hardware Review (6)

(a) (b)

(a) Steps in starting an I/O device and getting interrupt


(b) How the CPU is interrupted

32
Computer Hardware Review (7)

Structure of a large Pentium system


33
Operating System Concepts (1)

• A process tree
– A created two child processes, B and C
– B created three child processes, D, E, and F

34
Operating System Concepts (2)

(a) A potential deadlock. (b) an actual deadlock.


35
Operating System Concepts (3)

File system for a university department


36
Operating System Concepts (4)

• Before mounting,
– files on floppy are inaccessible
• After mounting floppy on b,
– files on floppy are part of file hierarchy

37
Operating System Concepts (5)

Two processes connected by a pipe

38
Steps in Making a System Call

There are 11 steps in making the system call


read (fd, buffer, nbytes)
39
Some System Calls For Process Management

40
Some System Calls For File Management

41
Some System Calls For Directory Management

42
Some System Calls For Miscellaneous Tasks

43
System Calls (1)
• A stripped down shell:

while (TRUE) { /* repeat forever */


type_prompt( ); /* display prompt */
read_command (command, parameters) /* input from terminal */

if (fork() != 0) { /* fork off child process */


/* Parent code */
waitpid( -1, &status, 0); /* wait for child to exit */
} else {
/* Child code */
execve (command, parameters, 0); /* execute command */
}
}

44
System Calls (2)

• Processes have three segments: text, data, stack


45
System Calls (3)

(a) Two directories before linking


/usr/jim/memo to ast's directory

(b) The same directories after linking

46
System Calls (4)

(a) File system before the mount


(b) File system after the mount

47
System Calls (5)

Some Win32 API calls


48
Operating System Structure (1)

Simple structuring model for a monolithic system

49
Operating System Structure (2)

Structure of the THE operating system


50
Operating System Structure (3)

Structure of VM/370 with CMS

51
Operating System Structure (4)

The client-server model

52
Operating System Structure (5)

The client-server model in a distributed system

53
Metric Units

The metric prefixes

54

You might also like