Professional Documents
Culture Documents
Unit 1 - Intro To OS
Unit 1 - Intro To OS
CAF 614
Syllabus
• Introduction to OS
• Component of Computer System
• Operating System view: User’s view & System view
• Evolution of OS
4
Introduction to Operating Systems
• An Operating system is the resource manager i.e. it can manage the resource of a
computer system internally.
• The resources are processor, memory, files, and I/O devices. In simple terms, an
operating system is the interface between the user and the machine.
5
Structure of Operating System
(Contd…):
4.Application programs
This is dependent on users need. Ex.
MS-Office, Browsers, Railway
reservation system, Bank database
management etc.,
7
Introduction to Operating Systems
• Processor management which involves putting the tasks into order and
pairing them into manageable size before they go to the CPU.
• Memory management which coordinates data to and from RAM (random-
access memory) and determines the necessity for virtual memory.
• Device management which provides interface between connected devices.
8
Introduction to Operating Systems
9
Introduction to Operating Systems
Based on number of task handled Based on number of users Based on user interface
concurrently
10
Introduction to Operating Systems
11
Two Views of Operating System
12
Modes of Operation
13
Operating-System Operations
• System call changes mode to kernel, return from call resets it to user
17
Uniprogramming
18
Evolution of Operating Systems
Hardware upgrades
New services
Fixes
19
Evolution of Operating Systems
Stages include:
Time
Multiprogram Sharing
med Batch Systems
Simple Systems
Batch
Serial Systems
Processi
ng
20
Serial Processing
21
Simple Batch Systems
22
Batch Processing:
• In Batch processing same type of jobs batch (BATCH- a set of jobs with similar needs)
together and execute at a time.
• The OS was simple, its major task was to transfer control from one job to the next.
• The job was submitted to the computer operator in form of punch cards. At some later time
the output appeared.
• The OS was always resident in memory. (Ref. Fig. next slide)
• Common Input devices were card readers and tape drives.
23
Batch Processing (Contd…):
• Common output devices were line printers, tape drives, and card punches.
• Users did not interact directly with the computer systems, but he
prepared a job (comprising of the program, the data, & some control
information).
OS
User
progra
m area
24
Simple Batch Systems
• hard to debug.
• The other jobs will have to wait for an unknown time if any job fails
25
Multiprogramming
• There must be enough memory to hold the OS (resident monitor) and one user program
• When one job needs to wait for I/O, the processor can switch to the other job, which is
likely not waiting for I/O
26
Multiprogramming
• Multiprogramming
27
What is Multiprogramming?
multiprogramming operating system, other programs are always ready to use the
CPU. As a result, numerous jobs can share the CPU's time. However, in a
executed simultaneously.
There are various advantages and disadvantages of multiprogramming. Some of them are as
follows:
Advantages:
Disadvantages
30
Multitasking contd.
• The PC requires a huge memory to execute multitasking (RAM ). Its primary goal is to
improve the timing of the CPU's response. Users can engage with the system during
multitasking, for example, by typing a letter while the printing process is running.
31
Advantages and disadvantages of multitasking
There are various advantages and disadvantages of multitasking. Some of them are as
follows:
Advantages
Disadvantages
• Multiple users simultaneously access the system through terminals, with the OS
interleaving the execution of each user program in a short burst or quantum of
computation
33
Batch Multiprogramming
vs. Time Sharing
The main difference between Multi programmed Batch Systems, and Time-Sharing
Systems is that in multiprogrammed batch systems, the objective is to maximize processor
use.
In contrast, in Time-Sharing Systems, the objective is to minimize response time
34
Multiprocessor System
• have two or more central processing units (CPUs) share full access to a
common RAM.
• Objective is to boost the system’s execution speed, with other objectives being
fault tolerance and application matching.
• shared memory multiprocessor - all the CPUs shares the common memory
• Benefits:
• Enhanced performance.
• Multiple applications.
• Multiprocessing is the use of two or more central processing units within a single computer
system.
• Asymmetric Multiprocessing and Symmetric Multiprocessing
• Symmetric Multiprocessing:
36
In these types of systems, each processor contains a similar copy of the
operating system and they all communicate with each other. All the
processors are in a peer to peer relationship i.e. no master - slave
relationship exists between them.
37
Symmetric and Asymmetric System
• Asymmetric Multiprocessing:
38
In asymmetric systems, each processor is given a predefined task. There is
a master processor that gives instruction to all the other processors.
Asymmetric multiprocessor system contains a master slave relationship.
39
Advantages of Multiprocessor Systems
• Increased Expense
• Complicated Operating System Required
• Large Main Memory Required
40
Distributed Operating Systems
42
CAF614 – Operating System
Unit – 1 Lecture4
Learning Objectives
In this Lecture you will learn about:
• Multimedia System
• Real Time System
• Handheld System
• Mobile System
• Cloud System
44
Real Time System
• Used in environments where a large number of events, mostly external to the computer system, must
be accepted and processed within certain deadlines.
• Like in industrial control, telephone switching equipment, flight control, and real time simulations.
• For example, a robot is hired to weld a car body, if robot welds too early or too late, the car
cannot be sold, so it is a hard real time system that require to complete car welding by robot
hardly on the time.
• Soft real time operating system:
45
Real Time System
• Advantage:
• Maximum consumption –
• Maximum utilization of devices and system. Thus more output from all the resources.
• Task Shifting –
• Time assigned for shifting tasks in these systems are very less. For example in older systems it
takes about 10 micro seconds. In shifting one task to another and in latest systems it takes 3
micro seconds.
• Focus On Application –
• Focus on running applications and less importance to applications which are in queue.
• Real Time Operating System In Embedded System –
• Since size of programs are small, RTOS can also be embedded systems like in transport and
others.
• Error Free –
• These types of systems are error free.
46
Multimedia System
• In multimedia applications, a lot of data manipulation (e.g. A/D, D/A and format conversion) is required
and this involves a lot of data transfer, which consumes many resources.
• The integration of discrete and continuous multimedia data demands additional services from many
operating system components.
• The major aspect in this context is real-time processing of continuous media data.
• Issues concerned:
• File systems: outlines disk access algorithms, data placement and structuring
47
COMPUTER-BASED MULTIMEDIA
Technological advances have changed the hardware and software used for
developing multimedia from the traditional analog equipment to computer-
based or digital multimedia systems. Computers use 0s and 1s to store and
process sounds, still graphics (pictures), and motion video. Text scanning,
digital imaging (using digital cameras and scanners), sound cards, and analog
video-capturing devices sample, compress, and convert analog media into a
series of 0s and 1s (digital) signals for processing by a computer. Once analog
media are converted to a digital format, a computer can be used to manipulate
the various media. With the development of digital-video cameras and digital-
still cameras, media are already in a form that the computer can process,
making it easier to merge text, graphics, video, sounds, and animation into an
application.
48
Handheld System
• It is a small portable devices that can be carried along and are capable of performing normal operations.
• Examples include Personal Digital Assistants (PDAs), mobile phones, palm-top computers, pocket-PCs
etc.
• Weights and sizes have certain limitations as a result they are equipped with small memories, slow
processors and small display screens, etc.
• The physical memory capacity is very less (512 KB to 128 MB) hence the operating systems of these
devices must manage the memory efficiently.
• As the processors are slower due to battery problem, the operating system should not burden.
49
CAF614 – Operating System
Unit – 1 Lecture 5
Learning Objectives
In this Lecture you will learn about:
• Components
51
A View of Operating System Services
52
Operating System Services
• Operating systems provide an environment for execution of programs and services to programs
and users
• One set of operating-system services provides functions that are helpful to the user:
• User interface - Almost all operating systems have a user interface (UI).
• Program execution - The system must be able to load a program into memory and to run that
program, end execution, either normally or abnormally (indicating error)
• I/O operations - A running program may require I/O, which may involve a file or an I/O
device
53
Operating System Services (Cont.)
• One set of operating-system services provides functions that are helpful to the user (Cont.):
• File-system manipulation - The file system is of particular interest. Programs need to read and write files
and directories, create and delete them, search them, list file Information, permission management.
• Communications – Processes may exchange information, on the same computer or between computers
over a network
• Communications may be via shared memory or through message passing (packets moved by the OS)
• May occur in the CPU and memory hardware, in I/O devices, in user program
• For each type of error, OS should take the appropriate action to ensure correct and consistent
computing
• Debugging facilities can greatly enhance the user’s and programmer’s abilities to efficiently use the
system
54
Operating System Services (Cont.)
• Another set of OS functions exists for ensuring the efficient operation of the system itself via resource sharing
• Resource allocation - When multiple users or multiple jobs running concurrently, resources must
be allocated to each of them
• Many types of resources - CPU cycles, main memory, file storage, I/O devices.
• Accounting - To keep track of which users use how much and what kinds of computer resources
• Security of the system from outsiders requires user authentication, extends to defending external I/O devices from invalid
access attempts
55
User Operating System Interface - CLI
56
Bourne Shell Command Interpreter
57
User Operating System Interface - GUI
59
CAF614 – Operating System
Unit – 1 Lecture 6
Learning Objectives
In this Lecture you will learn about:
61
System Calls
• It is the programmatic way in which a computer program requests a service from the kernel of the
operating system it is executed on.
• A system call is a way for programs to interact with the operating system.
• A computer program makes a system call when it makes a request to the operating system’s kernel.
• System call provides the services of the operating system to the user programs via Application
Program Interface(API).
• It provides an interface between a process and operating system to allow user-level processes to
request services of the operating system.
• System calls are the only entry points into the kernel system.
• All programs needing resources must use system calls.
• Services Provided by System Calls :
• Process creation and management
• Main memory management
• File Access, Directory and File system management
• Device handling(I/O)
• Protection
• Networking, etc.
62
Example of System Calls
• System call sequence to copy the contents of one file to another file
Types of System Calls
• File management
• create file, delete file
• Device management
• request device, release device
64
• Information maintenance
• Communications
• send, receive messages if message passing model to host name or process name
• Protection
• Control access to resources
66
Examples of Windows and Unix System Calls
67
API – System Call – OS Relationship
Standard C Library Example
• C program invoking printf() library call, which calls write() system
call
fork() in C
Fork system call is used for creating a new process, which is called child process, which
runs concurrently with the process that makes the fork() call (parent process). After a
new child process is created, both processes will execute the next instruction following
the fork() system call. A child process uses the same pc(program counter), same CPU
registers, same open files which use in the parent process.
It takes no parameters and returns an integer value. Below are different values returned
by fork()
70
Fork() return values:
1. Negative Value: creation of a child process was unsuccessful.
2. Zero: Returned to the newly created child process.
3. Positive value: Returned to parent or caller. The value contains process ID of newly
created child process.
71
int main()
{
printf("Hello world!\n");
return 0;
}
Output:
Hello world!
Hello world!
72
Calculate number of times hello is printed
int main()
{
fork();
fork();
fork();
printf("hello\n");
return 0;
}
Output:
hello
hello
hello
hello
hello
hello
hello
hello
The number of times ‘hello’ is printed is equal to number of process created. Total Number
of Processes = 2n, where n is number of fork system calls. So here n = 3, 23 = 8
73
Number of Child processes created = 2n-1
74