Operating Systems (Mid 1 Notes)
Operating Systems (Mid 1 Notes)
SE – A Operating Systems
OPERATING SYSTEM
It makes a platform over the hardware, a platform where the user can run his
application software to perform a specific task.
1. RAM
2. Processor
3. Hard Disk
Etc.
1. Program Execution
2. I/O Operations
3. File-System Manipulation
4. Communications
5. Error Detection
6. Resource Allocation
7. Accounting
8. Protection and Security
SYSTEM INTERRUPTS
INTERRUPT HANDLER
After a user makes an interrupt, some instructors are given for further to let
the system know why the interrupt was generated.
Interrupt Handler is a special type of code block, the control is directly given
to interrupt handler, it then executes the code that is placed in the handler.
INTERRUPT VECTOR
Interrupt vector are special type of codes, that contains the address to
interrupts.
It prioritizes the interrupts and saves them in a queue if more than one
interrupt is waiting to be handled.
KERNAL
Whenever we say OS is responsible for doing this and that, 99% of the times
we are referring to Kernal.
MODE BIT
Mode bit is a bit which tells you which mode you are in.
PERFORMANCE TUNING
TRACING
PROCESS
PROCESS STATES
1. New
2. Ready
3. Running
4. Waiting
5. Terminated.
NEW
At this stage it us just a program, which is newly created and not loaded into
the memory.
READY
Program is loaded into the memory and waiting to be executed.
The Ready and Running state shift depends upon the scheduling algorithms.
RUNNING
The program got the processor to start running.
TERMINATION
Now the process has been run, it has completed the tasks for which it was
running, it will now be terminated.
WAITING
Suppose a process is in running state, but after execution of some tasks, the
process requires an input for the user to execute further, so now the process
will wait for an input from the user or some other program, so at this time
the process is in waiting state.
After waiting state, the program will not return to running state, it will go into
ready state. Cause during the waiting state, the CPU assigned the processor
to some other process since the previous one was waiting for an input.
It is design to keep the data of a process, and every process has its own PCB.
Process use its PCB to store the data such as, Process state, Program
counter, CPU registers, Memory, I/O Status, etc.
PROCESS SCHEDULING
The processes are not sensible enough to schedule themselves one after
another, so the OS take this responsibility. OS Schedule these processes
using the scheduling algorithms.
SCHEDULING QUEUE
A place where the process waits to get the resources is known as Scheduling
Queue.
SCHEDULING ALGORITHM
The role of scheduling algorithm is to:
CONTEXT – SWITCH
A processor switch from one process to another when the one process
terminates or goes into waiting state.
THREADS
It does not have a PCB it relays on the PCB of the process under which it is
behaving like a process.
1. Running
2. Ready
3. Blocked
PROCESS CREATION
If a process creates a child process that child uses the resources of the
parent process, Parent can also limit the resource usage of child process. A
child process can further create more child and form a complete tree.
PROCESS TERMINATION
One addition thing that it does is that at normal termination it returns some
data to its parent process. That is the result of the tasks it was assigned to
do so.
If sometimes parent wants to terminate the child process due to any reason,
the parent will issue the Abort () call to its child and kill it.
ORPAN PROCESS
Usually when a parent is terminated the children also terminate with it, but it
not always the case, sometimes the child chose to continue its execution,
such child processes are known as Orphan process.
ZOMBIE PROCESS
On Unix and Unix-like computer operating systems, a zombie
process or defunct process is a process that has completed execution
(via the exit system call) but still has an entry in the process table: it is
a process in the "Terminated state".
MULTI-THREADING
Multithreading allows you to execute different threads at the same time.
ADVANTAGES OF MULTITHREADING
1. Responsive
2. Resource sharing
3. Multiprocessor Architecture Utilization
TYPES OF THREADING
1. Kernel-Level threads
They allow kernel to perform all kernel level tasks in parallel manner.
2. User-Level threads
These threads are so fast, most of the times kernel do not have
complete information of these threads.
They manage themselves without interrupting operating system and
kernel too much.
MULTITHREADING MODEL
User thread must be mapped to kernel thread, so the operating system
remains aware of what is going on in user mode and provide resources if
needed from kernel.
1. Many to One
2. One to One
3. Many to Many
CHAPTER 4
PRE EMPTIVE
From Ready Queue (Main Memory) to CPU, and the process is removed from
the queue, even if it is still executing.
The first factor due to which we do this switch is Time Quantum, it means the
CPU has already decided that it will execute the certain process for n
seconds.
Algorithms:
NON-PRE-EMPTIVE
The CPU is allocated to the process until the process terminates or switches
to waiting state.
Algorithms:
1. FCFS (First Come First Serve)
2. SJF (Shortest Job First)
3. LJF (Longest Job First)
4. HRRN (Highest Responsive Ration Next)
5. Multilevel Queue
TIMES
1. Arrival Time: The time at which the process enters ready Queue or
state.
2. Burst Time: Time required by process to get executed on CPU.
3. Completion Time: The Time at which the process completes its
execution.
4. Turn Around Time: (Completion Time – Arrival Time)
5. Waiting Time: (Turn Around Time – Burst Time)
6. Response Time: (The at which the process got CPU first time – Arrival
Time)
DISPATCHER
◦ switching context