The Basic Concepts of Operating Systems (OS)

Operating  system concepts
This photo is taken from [1]

An operating system (OS) exploits the hardware resources of one or more processors to provide a set of services to system users[1].

The operating system is a program that can play a middle role between hardware and software.

Figure 1. Operating system relations [2]

Basic Elements

At a top-level, a computer consists of a processor (CPU), main memory(RAM), and input/output (I/O) components, with one or more modules of each type. These components are interconnected in some fashion to achieve the main function of the computer, which is to execute programs. Thus, there are four main structural elements[1]:

Figure 2. Motherboard [3]

1. Processor: Controls the operation of the computer and performs its data processing functions. When there is only one processor, it is often referred to as the central processing unit (CPU).

2. Main memory: Stores data and programs. This memory is typically volatile; that is, when the computer is shut down, the contents of the memory are lost. In contrast, the contents of disk memory are retained even when the computer system is shut down. Main memory is also referred to as real memory or primary memory.

3. I/O modules: Move data between the computer and its external environment. The external environment consists of a variety of devices, including secondary memory devices (e.g., disks), communications equipment, and terminals.

4. System bus: Provides for communication among processors, main memory, and I/O modules.

Figure 3. Computer Components: Top-Level View[1]

Watch my youtube video about computer architecture:

https://www.youtube.com/watch?v=hw6FJqRNDe4

Cache Memory

Although cache memory is invisible to the OS, it interacts with other memory management hardware.

We are faced with a trade-off between speed, cost, and size in the memories. Ideally, main memory should be built with the same technology as that of the processor registers, giving memory cycle times comparable to processor cycle times. This has always been too expensive a strategy. The solution is to exploit the principle of locality by providing a small, fast memory between the processor and main memory, namely the cache[1].

Figure 4 depicts the structure of a cache/main memory system. Main memory consists of up to 2 to the power of n addressable words, with each word having a unique n-bit address. For mapping purposes, this memory is considered to consist of a number of fixed-length blocks of K words each.

That is, there are,

Ref : [1]
Figure 4. Cache/Main-Memory Structure [1]

Cache Principles:

The cache contains a copy of a portion of the main memory. When the processor attempts to read a byte or word of memory, a check is made to determine if the byte or word is in the cache. If so, the byte or word is delivered to the processor. If not, a block of main memory, consisting of some fixed number of bytes, is read into the cache and then the byte or word is delivered to the processor. Because of the phenomenon of the locality of reference, when a block of data is fetched into the cache to satisfy a single memory reference, it is likely that many of the near-future memory references will be to other bytes in the block [1].

Figure 5. Cache and Main Memory

Components

The components of an operating system all exist in order to make the different parts of a computer work together. All user software needs to go through the operating system in order to use any of the hardware, whether it be as simple as a mouse or keyboard or as complex as an Internet component[4].

Kernel: Kernel is the core of OS; it provides the most basic level of control over all of the computer’s hardware devices. It manages memory access for programs in the RAM, it determines which programs get access to which hardware resources [4].

Figure 6. Kernel [5]

Memory management: In a uniprogramming system, the main memory is divided into two parts: one part for the operating system (resident monitor, kernel) and another part for the program currently being executed. In a multiprogramming system, the “user” part of memory must be further subdivided to accommodate multiple processes. The task of the subdivision is carried out dynamically by the operating system and is known as memory management[1].

Table1. Memory Management Techniques [1]

The operating system is managing memory and is responsible for bringing this process into main memory[1].

Somehow, the processor hardware and operating system software must be able to translate the memory references found in the code of the program into actual physical memory addresses, reflecting the current location of the program in the main memory[1].

Interrupts: Virtually all computers provide a mechanism by which other modules (I/O, memory) may interrupt the normal sequencing of the processor. Interrupts are provided primarily as a way to improve processor utilization[1].

Figure 7. Changes in Memory and Registers for an Interrupt[1]

Program execution, modes, virtual memory, multitasking, disk access, file systems, networking, security, user interface, and device drivers are the other components of the operating systems[4].

I hope you find this article helpful for your basic computer knowledge; please share this article with your friends and colleagues.

Contact me:

https://github.com/Melanee-Melanee

References:

[1]. Operating Systems: Internals and Design Principles (8th Edition), William Stallings

[2]. https://www.uow.edu.au/student/learning-co-op/technology-and-software/operating-systems/

[3]. https://www.alamy.com/stock-photo-computer-motherboard-printed-circuit-board-173091365.html

[4]. https://en.wikipedia.org/wiki/Operating_system

[5]. https://www.javatpoint.com/what-is-kernel

Python | Data Science Programmer