Operating System Ch-1
Operating System Ch-1
1
What is an Operating System?
❖ is a fundamental piece of software that runs in kernel mode
(supervisor mode).
2
❖ Kernel is responsible for low level task management such as
Disk management, Task Management & Memory
Management
✔ User mode
❖ User Mode: Any user program runs in user mode can access
RAM & H/W.
✔ Shell
4
Difference between OS & S/W
❖ If a user does not like particular software then he / she can free
to get a different one / write design own software. But can’t
write a own interrupt handler (part of OS)
❖ Memory Management
❖ Processor Management
❖ File management
❖ Device Management
❖ Security Management
❖ User interfacing
❖ Coordination of communication
❖ Error detecting aids
6
Memory management refers to management of Primary Memory
or Main Memory.
7
Processor Management
✔ Decides which process gets the device when and for how much time.
✔ De-allocates devices.
8
File Management
9
▪ Communication: Processes may exchange information, on the
same computer or between computers over a network.
11
Types of operating systems
• The system put all of the jobs in a queue on the basis of first come
first serve and then executes the jobs one by one. The users collect
• 2. Not Interactive
15
Time-sharing Operating Systems
16
Distributed Operating System
17
Network Operating System
19
Real-Time Operating System
21
Con…
Additional functions exist not for helping the user, but rather for
ensuring efficient system operations.
▪ Resource allocation – allocating resources to multiple users or
multiple jobs running at the same time.
▪ Accounting – keep track of and record which users use how
much and what kinds of computer resources for account billing
or for accumulating usage statistics.
▪ Protection – ensuring that all access to system resources is
controlled. Protection refers to mechanism or a way to control
the access of programs, processes, or users to the resources
defined by computer systems. The ff major activities of
protection :-
✔ OS ensures that all access to system resources is controlled.
✔ OS ensures that external I/O devices are protected from invalid access
attempts.
✔ OS provides authentication feature for each user by means of a password.
22
System Call in Operating System
• System calls provide the interface between a running program
and the operating system.
• System call is the programmatic way in which a computer
program requests a service from the kernel of the operating
system it is executed on.
• 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).
▪ Generally available as assembly-language instructions.
▪ Languages defined to replace assembly language for systems
▪ Programming allow system calls to be made directly (e.g., C, C+
+)
▪ All programs needing resources must use system calls. 23
Con…
• Three general methods are used to pass parameters between a running
program and the operating system.
▪ Pass parameters in registers.
▪ Store the parameters in a table in memory, and the table address is
passed as a parameter in a register.
▪ Push (store) the parameters onto the stack by the program, and pop
off the stack by operating system.
24
Con…
• Types of system calls
▪ Process control
▪ File management
▪ Device management
▪ Information maintenance
▪ Communications
• Process control:-A running program needs to be able to stop
execution either normally or abnormally.
• File Management:- Some common system calls are create, delete,
read, write, reposition, or close. Also, there is a need to determine
the file attributes – get and set file attribute.
• Information Management:- Some system calls exist purely for
transferring information between the user program and the
operating system. An example of this is time, or date.
25
Con…
• Device Management:- Process usually require several resources to
execute, if these resources are available, they will be granted and
control returned to the user process. These resources are also
thought of as devices. Some are physical, such as a video card, and
others are abstract, such as a file.
• Communication:- There are two models of inter process
communication, the message-passing model and the shared
memory model.
✔ Message-passing uses a common mailbox to pass messages
between processes.
✔ Shared memory use certain system calls to create and gain access
to create and gain access to regions of memory owned by other
processes. The two processes exchange information by reading and
writing in the shared data.
26
Con…
Examples of Windows and Unix System Calls –
Windows Unix
CreateProcess() fork()
Process Control ExitProcess() exit()
WaitForSingleObject() wait()
CreateFile() open()
ReadFile() read()
File Manipulation
WriteFile() write()
CloseHandle() close()
SetConsoleMode() ioctl()
Device Manipulation ReadConsole() read()
WriteConsole() write()
GetCurrentProcessID() getpid()
Information Maintenance SetTimer() alarm()
Sleep() sleep()
CreatePipe() pipe()
Communication CreateFileMapping() shmget()
MapViewOfFile() mmap()
27
End of Chapter 1
Operating System
28