A computer operating system has three primary purposes: allocating resources between hardware and programs, providing a platform for application programs to execute on, and operating as the control program supervising I/O devices. The objectives are achieved through an operating system's core functions: Process Management, Memory Management, File management, I/O Device Management, security, and protection. At the top of the OS hierarchy is the User Interface, where the user interacts with the computer. From there, user applications and system programs, programs that run in the background and do not require user interaction, make system calls that interact with the services provided by the OS.
Computer systems consist of many processes, including user processes and operating-system processes. Processes are programs in execution, each one a list of instructions. Processes are represented as Process Control Blocks (PCB), which contain important information like the program code, the program counter, which tracks the next instructions, and the process state. The process state indicates where the process is in execution, between New, Waiting, Ready, Running, and Terminated. Threads are within processes, which are instructions for execution within a process. With the introduction of multi-processing and multi-threading, process management has become more important than ever to ensure processes are protected from one another during execution. The OS manages kernel threads, which handle resource allocation, and kernel threads are mapped to user threads in various models, including Many-To-One, where many user threads are mapped to a single kernel, One-To-One where one user thread is mapped to one kernel, and Many-to-Many where many user threads are mapped to less than or equal amounts of kernel threads.
Within the computer system, the hardware lives the memory, split into four types that interact together. The registers in the CPU core are the fastest and smallest memory, storing limited data that is frequently used like operands. The cache memory lives in the processor, is also fast but limited, and typically acts as a buffer between the cache and Main Memory. The main memory (RAM) typically stores active processes, and because it is volatile, any data is lost when turned off. Finally, secondary storage, such as HDD and SDD, is non-volatile, so information can be stored with no power and acts as long-term storage.
Because processes must move between all different memory types, memory management is important for improving CPU utilization and computer response time amongst the multiple active processes. Memory management algorithms vary, but the most important determinant of the method is the hardware provided. The CPU can only access the main memory and registers onboard the processor, so process instructions must be in one of the direct access storage devices. When a process is ready for execution, its code and data are moved into the main memory from the secondary storage. Those processes waiting to be brought into the memory make the input queue, from which a single-tasking procedure selects one and loads the process into the memory. Each process in the main memory must have its own defined memory space to protect it from other processes and ensure processes can run concurrently. To do so, we use two registers: the base register and the limit register. The base register contains the smallest physical memory address of the processes allocated memory, while the limit register defines the range size from that base. Thus, when the CPU goes to check if the address generated in user mode if the program attempts to access operating-system memory or other process-defined memory, it results in a trap. When a program is executed, the binary executable file must be brought into the memory and placed in a process. Virtual memory is when the main memory is expanded into the secondary storage to simulate a larger main memory for more or larger processes.
The next important function of an operating system is file management. In the file system, some files contain related data and file directories with information on the files within the system. Different operations can be performed on files, including creating, writing, reading, deleting, truncating, and repositioning within files. File management functions include access control for users and programs, access methods to obtain information, sharing files between users and other systems, and file protection by defining access types, user access control, passwords, and enhancing reliability through backup copies. File directories are crucial in maintaining file systems by organizing and providing information on all files. Directory operations include creating, deleting, renaming, and searching for files, listing directories and contents, and traversing the file system. There are many types of directory schemes that dictate how files and sub-directories are laid out and interact with each other.
Input and Output devices vary widely, from storage devices, transmission devices, and human-interfaced devices to other specialized devices. The CPU moves data between the I/O devices and memory by sending read and write bit patterns to the controller’s data and control signal registers. Device drivers help the OS communicate with these devices by translating commands between the OS and the I/O devices and acting as an in-between between the software layer and physical hardware.
Finally, the last important function of an operating system is to provide protection and security for the computer system. Protection is controlling access to resources in the computer system for programs, processes, and users. It is necessary to prevent internal access violations from ill intent and ensure active programs only use necessary resources. Access Control can be determined in different ways, each to secure resources and limit access to only what is necessary. Security is focused on external threats and computer system security. Working to prevent security threats reduces the need to react to threats. These threats can be targeted or unintentional. Protection methods like access control help protect and secure from unauthorized access, destruction, or alteration of resources. User authentication methods like passwords or two-factor authentication can additionally help protect systems. Encrypting data for secure transfer helps secure networks and programs. While not covered in the book, one of the biggest vulnerabilities to a computer system is the user, making user training in security best practices a large contributor to protecting programs, systems, and networks.
With the world becoming increasingly computer-dependent and advanced, understanding the concepts of operating system theory will help in every field. From writing code with memory management in mind to running faster, more efficient processes, understanding and managing access for users and programs with a more fine-tuned approach, or even just interacting with your personal computer more efficiently and securely. OS theory concepts help enable you to better interact with computer systems in any field of work. As an Information Technology student, OS theory concepts are the building blocks to fundamental knowledge you can build upon in future classes.
CPT304 Operating Systems Theory & Design Concept Map-OS Theory Concept Map.drawio.png