5 minute read

OS is known as the most complex system in computer science. A modern general-purpose OS is said to have about 50 million lines of code. This OS manages various devices such as e-book readers, smartphones, and tablets as well as general PCs. It is also called smart because it is installed in various devices such as refrigerators and vacuum cleaners.

Personally, I think that it is not necessary to know how to design an operating system. However, I believe that knowing how the Operating System works is essential to becoming a better computer scientist or developer. There are many technologies and design patterns used in modern complex software that are used in the OS. Not only that, but if you’re going to build an OS for your ever-evolving hardware, it’s understandable. In order to understand the OS installed in these evolving hardware, to understand other software systems, it will be very helpful to understand the internal workings of the Operating System.

What is OS?

image

What is the definition of OS?

OS is a layer of software that manages resources for users and applications.

The OS is invisible to the user by default.

image

Let’s expand the picture above a bit. The lowest layer contains hardware. OS is software that runs on top of hardware. The OS includes a layer specialized for each device and a service specialized to each device provided to the application.

From the above figure, you can see that the OS runs in an environment isolated from the application. You can see that a part of the OS is linked to the APP as a system library and executed.

ReFree

The OS manages resources for applications running on the same physical machine, so that each application is isolated from each other. Because of this, applications do not affect each other even if each other’s bugs occur. Also, even malicious software does not affect the OS. Therefore, it is expressed that the OS acts as a refresh.

Resource sharing

The operating system should allow multiple applications to maximize machine usage when other applications are not running. Thus, the operating system allows multiple applications to run at once.

Individual applications can also handle multiple tasks at once. For example ,

  1. The webserver executes multiple tasks concurrently without waiting for each task to finish.
  2. If the web browser can render multiple pages while switching to another page, it can show better responsiveness.
  3. In multiprocessor, computation in parallel applications is separated into each core unit and calculation is performed. So, you can execute faster.

However, there are several challenges to be solved.

Resource allocation

The operating system must isolate concurrently running applications and allocate resources appropriately. Because memory is finite. Performance shown to users may vary depending on how OS allocates resources.

When allocating a resource, it is not directly to the hardware, but to an abstracted memory. If so, what would happen if you did the direct assignment?

while True :
One

If you allocate hardware directly for these programs, these programs will lock the computer’s resources forever.

In order for other programs to be allocated resources smoothly, even if an application is locking the resource, other applications must be able to allocate the resource without interfering with it.

Isolation

An error occurring in one application should not affect other applications, nor should it affect the OS itself. This is called ‘fault isolation’. If there is no fault isolation, the data structure and other resources of an application will be affected, and debugging will be difficult. In addition, you can limit one application not to use all the power of the running hardware. It can also prevent malicious software from affecting the OS.

Communication

There may be situations in which communication between applications as well as other users is required. However, the OS prevents a bug in one application from affecting another application and malicious software from affecting the OS or other applications through the above-mentioned fault isolation. If so, how do we communicate between applications? When setting boundaries between these applications, it is necessary to cross boundaries carefully.

It is the role of the operating system to balance these challanges mentioned above.

Illusionist

The OS is limited and the physical hardware is finite. You need to decide how to divide and allocate this hardware resource. Operating System makes designing an applicatoin simple by providing an abstraction of hardware.

Through virtualization, the OS provides an illusion of hardware rather than actual hardware to the application. Given the appropriate hardware and OS, most resources can be virtualized. However, the OS provides the illusion of infinite virtual memory to users and applications. Let’s take an example.

  1. Even if WireLess Network corrupts or drops packets, the OS hides these failures, providing the illusion of a reliable system.
  2. Most programmer hireachical works with named byte address files in a directory.
  3. Virtualize the processor type so that one application can run on another smartphone ,laptop or tablet.

image

It virtualizes the entire computer and runs the OS on it. It runs like an application running on the OS. These are called virtual machines. The os running in a virtual machine is called Guest Operating System. One of the advantages of these virtual machines is portability. When there is an applicatoin that only runs on the old version of the OS, it creates a virtual machine on the new version of the OS and allows it to be run using the guest operating system. Also, it helps with debugging. The OS is difficult to debug, but the virtual machine runs like an application, so you can set breakpoints, stop kerenl, and run a single line of code.

Common Service

The third core role of the OS is to provide a standardized, common service for applications. You can use this service to design your application more simply. The OS hides how network and disk devices work from users and applications.

One of the important reasons for providing such a common and common service is to facilitate data sharing between applications. To share data with each other, data must be stored in a standardized format, and file directories must be managed with a standardized system.

Examples of standardized services provided by OS are as follows.

  • general interface for difference graphic co processor , pixel format , network device.. etc.
  • graphical user interface library
    • pull down menu
    • cut and paste

Reference

Operating Systems: Principles and Practice: Anderson, Thomas, Dahlin, Michael: 9780985673529: Amazon.com: Books

CS 162 — Spring 2021 (berkeley.edu)

Leave a comment