Shreyas Malewar
GDSC GHRCE
Published in
5 min readFeb 28, 2021

--

Amidst the pandemic, our existence is pretty much dependant on Mobile Phones and Laptops be it education, finance, business or even entertainment(Yes! You aren’t alone even I binge-watched Netflix). I was wondering the other day, most of us know everything about our best friends but why not the computer which has been our backbone/best friend/educator all the long? In this article, I’ll be talking about

  1. What is an Operating System(OS),
  2. Types of Operating System and then dive deeper into
  3. System Structure(Microkernel, Kernel, System Calls),
  4. Scheduling(Processes, Process Control Block, CPU scheduling),
  5. Process Synchronization(Inter-Process Communication, Semaphores and Mutex),

Never mind if you are a CS grad or a technology enthusiast it doesn’t hurt to gain more knowledge. Feel free to check out my article titled “How is our code executed” and “The tale of web avenue”.

What is an Operating System?

Well, computer hardware only understands 0s and 1s i.e. binary language. And it gets complicated if we try to learn binary so OS works as an interface between hardware and user so as to ease the experience for the user. Secondly, it acts as a huge software package that controls the execution, scheduling, management of tasks as well as management of system resources. Pro-level multitasking isn’t? I wish my best friend had such superpowers.

Types of Operating Systems

This is a unique image. Identify and comment all the Operating System you see in it and get a chance to be featured on DSC GHRCE’s Instagram handles.

One should remember that a personal computer is not the only computer in the world. Few operating systems are also designed for some specific use cases networking monitoring, resource management etc. As they say “Har Ek friend zaruri hota hai(all friends are important)” we cannot gauge the importance of a particular OS, all are equally important.

  1. Batch Operating System -There is an operator in a batch OS that is responsible for categorizing jobs with similar needs and grouping them in batches. Multiple users can share the same batch OS and idle time in it is very less. The only requirement on the users part is that he/she should be well versed with batch os. E.g. Payroll System, bank statements.
  2. Time-sharing Operating System — Each job is allotted some time to execute irrespective of the user who created the job. The time allotted is called a quantum. Such systems are also known as multitasking os. E.g. Multics, Unix
  3. Distributed Operating System — Autonomous computers on the same network are interconnected and have their specific memory, processing power etc. The main motive of a distributed operating system is to access the resources which are not available in the given system. Failure of one system does not affect the entire system and data exchange speeds are much higher in this system.

System Structure

  1. Kernel — It is the core of an operating system and acts as an interface between hardware and system applications.
  2. Kernel I/O Subsystem — It manages the Input/Output scheduling i.e. the way/order in which the jobs are executed it improves the performance of the entire system. It also manages the buffer i.e. storing the data when being transferred between two devices and an application. Few advantages of buffering are coping up with speed mismatch of the data stream, adaption for data that have different data sizes. Error handling, Kernel Subsystem makes sure that a minor mechanical failure does not result in a shutdown of the entire system.
  3. System Call — It is the way in which user applications(paint, browser etc) interact with the kernel of the operating system. This happens with the help of the Application Program Interface(API). It allows the user-level process to request the process of the operating system.
Common system calls

So far we have uncovered What is an operating system, types of operating system and a system structure. Now let us see Scheduling, Process Synchronization, Deadlock and Memory management.

Scheduling

Imagine you have several tasks to do in a very limited time. Either you could spend your precious time doing tasks in an unorganized manner or you could schedule all the tasks in accordance with the importance and plan the work accordingly. A sane person will always schedule so does the operating system.

Process -It is referred to as a program in execution. A c++ code for binary search is a program whereas when we execute the program it becomes a process. There are different states of a process for e.g.

  1. New — a newly created process
  2. Ready — After the creation of a process it is moved to a ready state
  3. Run — A process currently running in CPU
  4. Wait — A process requests I/O access
  5. Suspended Ready — When the ready queue becomes full some process are shifted to suspend the ready state

Process Control Block — To identify and track processes OS allots a process ID (PID) and a number of different parameters to ensure smooth functioning of the system. Other PCB parameters are -

  1. Pointer -It is saved when a process changes its state. It is similar to Google Maps’ location history which points to all the places we have visited.
  2. Process State -stores state of the process
  3. Program Counter -It contains the address of the next instruction which is to be executed.
  4. Register -Contains information about accumulator, base and, general-purpose registers
  5. Open files list -List of files opened by the process

Context Switching -It is the process of saving the state of one process so that it can be restored or resumed at a later time.

Process Synchronization

We know how a process is scheduled but what if a process is not completed in the allotted time and then two processes are executed at the same time? Let’s see the problems in process management or the reason why we need to synchronize processes.

  1. Critical Section -When numerous processes are accessing the same code and memory there is a high probability that the value of the shared variable is wrong. This problem is solved with the help of 2 variables semaphore and mutex.
  2. Semaphore- It is a signalling technique that is used for controlling access to shared resources.
  3. Mutex -It is a mutual exclusion object that synchronizes access to a resource. It is a locking mechanism that makes sure that only one thread can access the critical section at a time.

If you have made it to this line great. Now you have a basic understanding of concepts related to operating systems. Feel free drop your suggestions for upcoming articles in the comment section.

References

  1. GeeksforGeeks

--

--

Shreyas Malewar
GDSC GHRCE

I love to code, but also an avid reader of Military history, Economics and geopolitics.