Showing posts with label OS-Theory. Show all posts
Showing posts with label OS-Theory. Show all posts

Basics of Operating System

Lets start with a broad view of a computing system there are 4 major components of a computing system:

  1. Hardware – CPU, Memory, I/O devices
  2. Operating System
  3. Application Programs – Compilers, web browsers, text editor programs
  4. Users

“What is an Operating System(OS)?”

OS itself is a piece of software, which runs all the time. We can say OS is similar to a government. It provides an environment in which the application programs can run. It creates this environment by performing different functions. Let’s see what the main functions of operating systems are.

As we discussed earlier, a computing system has hardware, and users. The operating system acts as middle man between these two by providing some services to both hardware and user.

From the user perspective, below are the functions of OS.

  • User Interface:There are Command Line Interface (CLI) and Graphical User Interface(GUI) provided by OS, through which the users can interact with hardware like I/O devices, memory space
  • I/O Operations: OS regulates the use of I/O devices by the user. For protection and efficiency usually user cannot directly interact with the I/O device. OS provide a means to do I/O operations. For example OS controls multiple users using a single printer.
  • File system manipulation: users may need to create and delete files, write to files and search for files. Operating system keeps track of all these file related activities. For example, if a user writes something to a file using a text editor application, OS keeps track of this write, so that the modification on the file reflects on the storage device.
  • Communication: certain times, user programs would need to communicate with each other. OS provides a means to inter-process communication via message passing and shared memory(we will see these two in detail later)
  • Error detection: there may be several error in CPU memory hardware(like power failure), in I/O devices and user programs. OS gracefully handles the error conditions so that the hardware and data is not damaged by the error.

The above 5 functions are OS functions provided to the user. Lets see what are the functions that OS provides to the computing system so that efficiency of the system is achieved. The below functions are important in multi-user and multi processing scenarios.

  • Resource allocation: There are several resources in a computer like CPU time, memory space, file storage space, I/O devices. Application programs requests these resources. There would be numerous user programs running at the same time, hence OS makes a decision on what to allocate to which user program. OS takes the decision in such a way that maximum efficiency is achieved.

    • Protection:There may be scenarios where multiple processes run at the same time. What will happen if a process can interfere with other, or it can interfere with the OS itself (remember, OS is also a program) there may be some malicious process, intentionally trying to harm the system too. OS provides protection to the system by limiting access to the system resources

    • Security: Security of the system from the outsiders(meaning those who are not indented to use this system)is also provided by OS. Each user have an account and they must provide a password to access their account. This is very important in a multi-user environment.

    So, we have seen the what an OS is and what are the main functions of the Operation System. Next chapter we will see the notion of “process” and how CPU is shared between multiple processes. We will also see an important topic of process scheduling.