Operating System
Operating System
Bios: bios stand for input output system the main task of boot loader is to copy transfer contents from
hard disk to ram.
Polling:
In polling the kernel check all the ports of a system to see if a hardware have been attached usually we
used to set a certain threshold e.g of 15 seconds.
interupt
All the modern operating system are interrupt based os, in which device controller hardware is installed
on each port which trigger or alarm when something is attached or key are typed.
A device controller is a physical part of a computer system that makes sense of the signals going to, and
coming from the CPU for the different input/output devices.
The Device Controller receives the data from a connected device and stores it temporarily in some
special purpose registers (i.e. local buffer) inside the controller. Then it communicates the data with a
Device Driver.
Loss interuped
When sometime the buffer is full it is called loss interuped. So an interrupt which was never handled by
the cpu is interrupt loss
Hardware interrupt are called interrupt but there are also interrupt which is generated by software is
called monitor call.
Device controlors has also a small amount of memory called the buffer
Five state of process:
Ready : in this stage the resources are aready given it is ready for the process
Waiting: in running stage if a process request hardware resources then it is in the waiting stage
Exit once the process is completed then this stage is called exit or terminate.
System cals are a set of functions provided by the os to access the hardware.
Interrupt vector table: whenever an interrupt happen in os it has a specific id, in the interrupt vector
table, os matches the id and executes the corresponding system call.
Character device: any device part of the hardware that read/write data characterly is character divice
Keyboard,Nic
You have two spaces in os, user space and kernel space,
Dual-Mode Operation:
• The dual-mode operation (enabled by the mode bit) ensures the separation of privileges.
Critical system functions run in kernel mode, while user applications run in user mode.
The mode bit helps the system isolate user-level applications from the sensitive parts of the operating
system (kernel), thereby preventing malicious or faulty user programs from crashing the system or
accessing protected resources.
Synchronous i/o:
Operation: In synchronous I/O, the program initiates an I/O operation (such as reading a file or
sending a message) and then waits until the operation is complete before proceeding with the next
instruction. During this time, the CPU remains idle and cannot execute other tasks.
Blocking: The calling thread is blocked while waiting for the I/O operation to finish. The program
cannot continue executing until the data has been fully transferred.
• Operation: In asynchronous I/O, the program initiates an I/O operation and immediately
continues with other tasks without waiting for the operation to finish. The program is notified
(via a callback or an event) when the I/O operation completes, at which point it processes the
result.
• Non-blocking: The calling thread is not blocked and can continue executing other code while the
I/O operation is handled in the background by the operating system or another thread.
Comparison Table:
Complexity Simple to implement and understand More complex, requires event handling
Performance Lower, as the CPU is idle during wait Higher, CPU can perform other tasks
Use Case Suitable for simple applications Ideal for high-performance or real-time systems
Normal working is that data is bring to memory from harddisk and then it’s processed segment wise.
The cpu process 4kb /s in every type of data.
Graphic card like devices bypass the cpu they directly process from ram because they have their own
processors.
Since the data is processed parallel to cpu this makes our computer fast.
Can we use dma for those devices that doesn’t have their own processors. ?
Dma is the mechanism of bypassing the cpu and directly processing the data from ram. These devices
needs to have their own processor.
System call: system calls are functions that directly interact with the hardware normally programmers
use api to interact with the system call. By api you means sugar coated methods.
Storage heriarchy: magnatic tape → magnatic disk → optical disk → SSD’s → Ram→ cache → registers
Cache memory:
Cache memory serve as a bridge between ram and cpu. Cpu always check an instruction in cache
memory before executing it, if an instruction is not found in cache we bring the complete tab from ram
cache. For the rest of the instructions in tab , they will be found in cache
How does the use of cache memory make the computer fast?
If an instruction is found in cache it is a cache hit. If an instruction is not found it is called as cache miss.
Multiprogramming : Executing more than one program at a time is called multi programming all modern
os are multiproramme in nature.
Timesharing: In timesharing system we divide the time between different processes to achieve
multiprogramming.
If we divide one second on 4 process , each process will take 250 ms.,
Process management: in process management we have process creation and processs deleting ,
multithreading,allocating and retreivig back the resources to process, managing process ‘priority ,
handling synchronization.
Storage management: Creating file system on hard disk , managing virtual memory on hard disk,
performing swapping on hard disk, managing file and directories on hard disk.
I/o management: sending and receiving data from i/o devices , handling interrupts from device
controllers, communicating with device drivers.
Protection and Security : Managing permeation of file and directories, protecting from viruses and
worms, implementing access policies.
1) Use register, put the data in the register and pass the data into the location of function
in vector table. We pass the name of the register into interupt service routine.
2) Use Table in memory: the parameter for example print(“Hello world”) hellow world will
be stored in ram.. we will save the address of the data in register, register goes to
interrupt service routine. Window use this process.
3) Os Stack: there are two stack, Os Stack and process stack.. We put the data in the os
stack and the interrupt service routing pop the data from the stack.. in linux the 3rd
method is used.
Wait for time: it is used when we want the process to wait for particular time
Wait for event: it is used to wait for a child process to complete its task. When process waits , its data is
stored in ram or hard disk on basis of its priority.
Operating Structure
Simple Structure..
Bios driver: this was the driver which were used to shift with the system.
In todays operatin system we don’t have concept of bios drivers we have device drivers.
In old structure: the haricarchy was application program→ system programs→os device driver→ bios
driver and application program was also allowed to directly access the bios driver.
Simple structure is the oldest technique of os structuring which is now obsolete. Ex: ms dos
It is best for debugging., but slow. Another major issue was the dependency..
MicroKernel:
Microkernel is a small size operating system, remove unnecessary layers from os.
Quiz Wednesday