Basics of Operating System


What is an Operating System?

An operating system is an interface to connect users to hardware. By requesting services through an API, the applications communicate with the operating system. Users can interact directly with the operating system by using command line interface(CLI) or GUIs.

The operating system is mainly used for convenience and throughput.

Uses of Operating System

  1. Resource Management
  2. Process Management (eg: scheduling)
  3. Storage Management (eg: HD)
  4. Memory Management (eg: RAM)
  5. Security Management

Types of Operating System

  1. Batch OS
  2. Multi-programmed OS
  3. Multi-tasking OS
  4. Real time OS
  5. Distributed OS
  6. Clustered OS
  7. Embedded OS

1. Batch Operating System

-Similar kinds of jobs given to computer to process.

-Earlier in 1900s, people used to put all their computer jobs offline to punch cards/paper tapes/magnetic tapes and give to operator(in person) to process. This was done because computers were not present everywhere to access.

-Data was processed in batches or groups.

-Non-preemptive type i.e. CPU will not move to next task until and unless it's first task is finished.

2. Multi-programmed Operating System

-Runs multiple programs at once.

-CPU will only go to next task if first task goes to some input/output device or gets completed. Else, it will complete the present task and then go to next.

3. Multi-tasking/Time sharing Operating System


-Follows scheduling rules to complete tasks

-Highly responsive

-Pays attention to all the tasks equally

4. Real time Operating System

-Time is priority

-Two types:

-Hard: Strictly time bounded (eg: missile operations; i.e. cannot risk even 1 second delay)

-Soft: Time bounded but not strictly (eg: video live streaming; i.e. can bear few seconds delays)

5. Distributed Operating System

-Tasks work independently at different locations

-Tasks distributed geographically

6. Clustered Operating System

-Tasks work on different systems but under same network

-Eg: LAN

7. Embedded Operating System

-Operating system working on machines (eg: refrigerator, washing machine etc)

-Works on a single functionality

What is a System Call?

It is a programmatic way in which a program goes to kernel mode from user mode.

Eg: 2+2=4 This is in a user mode i.e. the result is calculated by the processor

But print(2+2)

This is a kernel mode i.e. done by operating system. The program used system call at the background to print the result 4.

Types of System Call

1. File Related:

open(), close(), read(), write(), createFile() etc

2. Device Related:

Read, write, reposition, ioctl(input output control), fcntl(file control) etc.

3. Information Related:

This is used to fetch metadata like getPid(get process ID), attributes, get system time and date, getPPid(get parent process ID) etc

4. Process Control:

load, execute, abort, fork(used for multi threading), wait, allocate etc.

5. Communication Related:

Used for inter-process communication; eg: pipe(), shared memory, create/delete connection etc.

Thank you for reading.

Happy Learning!