DEV Community

Phoenix
Phoenix

Posted on

OS Notes - 1

*Operating Systems - *
It acts as an intermediate between computer applications and it's hardware. The OS handles tasks such as running applications, managing files, and controlling hardware like the keyboard, mouse, and printer, so you don’t have to manage these details yourself.

Multiprogramming Operating System - Multiprogramming utilizes the CPU more efficiently. The OS assigns a process to the CPU and when it waits for I/O the CPU assigns another process in the queue to the CPU. The main aim is not to keep the CPU idle.
Multitasking Operating System - In multitasking, each job or process is given some time to execute and the operating system switches the jobs after a certain interval of time. The switch is so quick that the user can interact with each program as it runs. This is also known as Time Sharing OS.

Process -
A process is a large independent program that is in execution.
Thread is small component in the process that performs individual tasks within program like running different parts of it at the same time.

Threads can directly communicate between each other because it shares memory space where as for process, OS interventatioon takes place.
There are two types of threads.
User threads - It is implemented by the user.
Kernel threads - It is implemented by the Operating System.

A thread has its own program counter, register set, and stack
A thread shares resources with other threads of the same process the code section, the data section, files and signals.

Context Switching- A context switch is the action of the computer switching from one task to another. It's necessary to efficiently manage different tasks and make sure they all get a turn to run.

Process Scheduling Algorithms
First Come First Serve (FCFS) - It schedules the Process according to the arrival time. The process which arrives first is scheduled first. It is the simplest scheduling algorithm.
Shortest Job First (SJF) - The Process which has the shortest execution time or Burst time is scheduled first in this algorithm.
Shortest Remaining Time First - The only difference between SJF and this is preemption happens in this. The processes are scheduled according to the shortest remaining time for execution.
Round Robin Scheduling - In Round Robin each process is cyclically assigned a fixed time. Each process executes for a certain time and waits for its turn again.
Priority Scheduling - In Priority Scheduling, processes are scheduled according to their priority. The process which has higher priority is scheduled first and so on.
Multilevel Queue Scheduling - There are multiple queues in this algorithm according to the priority of the processes. The processes with higher priority are placed in one queue and lower ones in another similarly. The processes with lower priority are executed only after the execution of all higher priority processes.
*Multilevel Queue with Feedback *- This also uses the multiple queues concept but the processes may be moved from lower priority queue to higher priority queue according to their feedback. If a process needs lower CPU time, it can be moved to a higher priority queue and vice versa.

Race Around Condition
This condition occurs when more than one process tries to access the same data at the same time and tries to manipulate it.

Process Synchronization is the coordination of execution of multiple processes in a multi-process system to ensure that they access shared resources in a controlled and predictable manner. It aims to resolve the problem of race conditions and other synchronization issues in a concurrent system.

A critical section is a code segment that can be accessed by only one process at a time.

Semaphore
A semaphore is a variable that is used to prevent the simultaneous access of common resources by one or more threads in concurrent systems.

A deadlock is a situation where multiple processes or threads are stuck because they're waiting for each other to release something. It can be prevented with careful design and resolved by outside intervention or by making one of the processes let go.
It is an unwanted situation in which processes block each other by holding one resource and waiting for another resource that is held by some other process.

Virtual Memory
Virtual memory is a technique that lets a computer use more memory than it actually has. It does this by using a combination of RAM (real memory) and space on the computer's hard drive to store data that might not fit entirely in RAM.

Top comments (0)