OS Theory


Categorize, describe, and give examples of the major functions of operating systems.

An Operating System acts as an interface between the user and computer hardware. 

An Operating System manages the computer's resources, such as the central processing unit, memory, disk drives, and printers. In addition, the operating system executes applications software.

The purpose of an operating system is to provide a platform on which a user can execute programs conveniently and efficiently.

The main task an operating system carries out is the allocation of resources, such as the allocation of memory, devices, processors, and information. The operating system also includes programs to manage these resources, such as a scheduler, memory management module, I/O programs, and a file system. 

 The primary functions of an operating system are: 

·         Memory Management-Keeps track of primary memory.

·         Processor Management- Keeps track of the status of processes, starts, and ends programs.

·         Device Management- decides which process gets access to which device and for how long. It then allocates the devices effectively and efficiently. This includes the main memory, drives, and access to files. It also includes the inputs and outputs of devices such as keyboards, mouses, monitors, and printers.

·         File Management- It keeps track of where information is stored and creates/deletes files. The user can open, read, write, and close files.

·         Security- The operating system uses password protection to protect user data and prevent unauthorized program access. Protection refers to the controlled access to a system by users, while security refers to the authentication of users, defending I/O devices, and recording breach attempts (Silberschatz, Galvin, & Gagne, 2014).

·         Accounting- keeps track of time and resources used by various tasks and users.

·         Error detection- constantly monitors the system; this is beneficial for detecting errors and avoiding malfunctioning a computer system.

 Once the operating system and the software communicate, the user can utilize the hardware, such as a monitor or the keyboard. 

Illustrate the hierarchy of subsystems, components, or subcomponents of operating systems and explain how they interact with one another.

Operating systems can vary in design. A monolithic architecture is a singular, extensive computing network with one code base that joins everything together. Monolithic software is designed to where the program's components or functions are tightly coupled. In a monolithic architecture, each component and its associated components must all be present for code to be executed for the software to run.

Modern operating systems tend to organize the components into smaller subsystems or subcomponents called modules. 

"In practice, very few operating systems adopt a single, strictly defined structure. Instead, they combine different structures, resulting in hybrid systems that address performance, security, and usability issues" (Silberschatz, Galvin, & Gagne, 2014).


Describe the process, process state, and process control block:

 According to Operating System Concepts Essentials (2nd ed.) (2014), a process is a program being executed. The process includes the current activity in the program, contents in the processor’s registers, and temporary data. 

 The process state could be one of five different states of the process:

   New - process is being created. 

   Running - instructions are executed.

   Waiting – The process is waiting for an event to occur, such as an input or output.

   Ready – Awaiting processor assignment.

Terminated – When the process is finished being executed.

According to Operating System Concepts Essentials (2nd ed.) (2014), The process control block is also referred to as the task control block. PCB is where each process is represented in the operating system. The process control block (PCB) would include the following information:

Process state – One of the states mentioned above.

 Program counter – The address of the next instruction to be executed.

 CPU registers – Registers vary depending on the computer’s architecture.

 CPU-scheduling information – Process priority, pointers to scheduling queues, or other scheduling information.

 Memory-management information – Could include values of the base and limit registers and page tables or segment tables

 Account information – Includes the amount of CPU and real-time used, time limits, account numbers, job or process numbers, etc. 

  I/O status information: Includes a list of input/output devices allocated to the process, a list of open files, etc.

Compare single- and multi-threaded motivations and models:

 A thread is a fundamental part of CPU usage. Threads have an ID, a program counter, a register set, and a stack. In a real-life scenario, I can think of a thread as a task that I would perform, such as doing the laundry and cooking a meal. Some tasks can be performed while performing other tasks. Modern computers are great at multitasking. They can take on several tasks and perform them at the same time. One single program could have multiple threads to execute. With a single-threaded process, each of these threads would be executed one at a time. Modern computers perform multi-threaded operations to save time. Many threads can be performed concurrently. When one thread is waiting on input from the user, the other threads can keep working. In a single-threaded process, waiting on an input would cause a slowdown. Multi-threaded processes can be implemented as user-level threads or kernel-level threads. Multithreading is more responsive, faster, at better at prioritization. Single threading has less overhead and is easy to debug because it is less complex. 

Critical-section problem and explain a software solution that resolves this problem:

 A critical section is a part of the code that does not allow any other process to occur while the program is in the critical section. The critical-section problem is designing a way that allows for processes to work around the critical sections. A solution to this problem must have the following requirements:

Mutual exclusion: If one process executes its critical section, no other can execute it.

Progress: If no processes are executing their critical section, but some processes are ready to enter their critical section, it must be decided which process will enter its critical section. This cannot be postponed indefinitely.

 Bounded waiting: A bound is established to limit the number of times other processes are allowed to begin their critical sections after a request has been made and before the request is granted. 


The objectives and functions of memory management in operating systems.

Relocation - Allows the movement of a process in memory without affecting the execution. The memory management operating system manages memory and converts the program's logical address to a physical one. The first address is stored as a virtual address 0.

Static Relocation: The program is relocated before a process in memory is loaded. It must always be in the same address space in memory. Otherwise, the relocator must be rerun.

Dynamic Relocation: This Process can freely move around in memory. Virtual-to-physical address space mapping is done at run-time.

Protection-Write Protection is used to prevent data and instructions from being overwritten.

Read Protection is used to ensure the privacy of data.

The operating system needs to be protected from user processes, and user processes need to be protected from each other.

Memory protection is supported by the hardware or limit registers.

Sharing- Occasionally, processes may need to execute the same function or data. The operating system must allow sharing but also provide Protection.

 

Compare and contrast the physical address space with the virtual address space as they relate to different memory mapping techniques in operating systems.

 A physical address refers to an actual physical address in memory. The memory management unit generates physical addresses. The CPU generates the virtual address and translates it into a physical address by the memory management unit.

In virtual memory, the operating system manages the location of processes in memoryVirtual memory allows the programmer to use more than the available physical memory for programs. This enables the execution of complex programs that require more memory than physical memory.

A Compiler / Interpreter calculates program addresses to the virtual address 0.

 The Dynamic Address Translation Mechanism transforms virtual addresses into physical addresses. Virtual address space can be smaller, or it can be the same size as the physical memory.

Physical memory refers to the RAM. Physical memory is a volatile memory. Therefore, it requires a continuous flow of power to retain data.

The main difference between physical and virtual memory is that physical memory refers to the actual RAM. Still, virtual memory is a management technique allowing users to execute programs larger than the real physical memory.

A physical or real address space is an address seen by the memory unit. MMU computes a physical address. A hardware device memory management unit does the run-time mapping from virtual to physical addresses (MMU). The physical address always remains constant.

Virtual and physical addresses define the memory's unique locations. The user can see the virtual address but cannot directly see the physical address. The virtual address is used to access the physical address in the operating system's memory.

Mapping Virtual Addresses to Physical Addresses

The memory contains many different addresses. The central processing unit collects instruction addresses from program files and loads the files to a memory address. This creates the mapping process from one address space to another address space. 

There are three methods to complete the address binding: compile time, load time, and execution time.

The physical address generates at the time of compilation during the program's execution. Unlike the compile time, the load time does not show where the process will reside; the loader will translate the relocated address to an absolute address. A loader will add the base address of the process to the virtual address to develop an absolute address. During execution time, the central processing unit already has the instructions. During execution, the additional memory can allocate or relocate.





 

 File System Management

According to Silberschatz, Galvin, & Gagne (2014), “The file system consists of two distinct parts: a collection of files, each storing related data, and a directory structure, which organizes and provides information about all the files in the system.” A file system is a logical storage unit that holds a collection of related information.

 The process files and data files a computer runs, and stores are stored on different methods of secondary storage. Some types of secondary storage include hard disks, magnetic tapes, optical disks, and solid-state drives (SSDs). Different operating systems require files to have specific attributes to help with identification. These include the name, identifier, type, location, size, protection, times, date, and user identification.

A file directory will view this information in a table, which allows the operating system to view and organize the files in a variety of ways. These attributes will be used to help a directory search for files, create files, delete files, rename files, list directories, and traverse the file system.

Single-level directories are the simplest directory structures. All files are in one directory. This makes the information easy to understand. Searching in a single-level directory is faster when the file sizes are smaller. Creating, deleting, renaming, and updating files are also easier. One limitation of a single-level directory is that it limits the user in terms of file names, the user must use unique names for each file, this may cause some confusion when other users are accessing the directory. Searching for files takes longer when the directory is larger.

Two-level directories are like single-level directories. In a two-level directory, each user has their own user files directory (UFD). This allows more than one user to have files with the same name. Each user file directory lists only that user’s files. The master file directory (MFD) is above all the UFDs. It can be searched to find each user and then their specific files. Searching files is easier with this type of directory. Users in a two-level directory are unable to share files with other users.

Tree structure directories provide many advantages and are widely used. Every file has a unique name. There is a much smaller chance of having name collisions. Searching for files in a tree structure directory is easier. Paths to each file are well laid out. In tree directories, the same file may be saved into multiple directories, making this type of directory less efficient and potentially leading to the user having several different versions of the same file. File sharing is not allowed in tree structure directories.

Acyclic-graph directories are like tree structure directories. The difference is this type of directory allows file sharing. This allows more than one user to view the same single file and is updated immediately with user changes.

General graph directories allow cycles within the directory. Multiple directories can be created from multiple parent directories. This type of directory allows more flexibility, however, they’re more costly and can potentially collect more garbage files.

Silberschatz, Galvin, & Gagne (2014) state that the purpose of in-memory structures is to aid in implementing the file system. “The in-memory information is used for both file-system management and performance improvement via caching. The data are loaded at mount time, updated during file-system operations, and discarded at dismount. Several types of structures may be included.”

File systems also manage file operations. To manage these file operations, the file system controls I/O transfers between the memory and disk in units of blocks (Silberschatz, Galvin, & Gagne, 2014). Specific structures in-memory and on-disc allow these transfers to occur. The file control block contains information about the file, such as ownership, permissions, and location of the file contents (Silberschatz, Galvin, & Gagne, 2014). Most I/O devices are used for storage, modes of transmission (Bluetooth), or user interface devices such as a mouse or a keyboard.

Some issues that may arise in acyclic file storage:

 A file can have several path names, specific file names may refer to the same file and deletion issues may arise as well. 

According to our textbook-

Silberschatz, A., Galvin, P. B., & Gagne, G. (2014) "An acyclic-graph directory structure is more flexible than a simple tree structure, but it is also more complex. Several problems must be considered carefully. A file may now have multiple absolute path names. Consequently, distinct file names may refer to the same file. This situation is like the aliasing problem for programming languages. If we are trying to traverse the entire file system—to find a file, to accumulate statistics on all files, or to copy all files to backup storage—this problem becomes significant, since we do not want to traverse shared structures more than once. Another problem involves deletion. When can the space allocated to a shared file be deallocated and reused? One possibility is to remove the file whenever anyone deletes it, but this action may leave dangling pointers to the now-nonexistent file. Worse, if the remaining file pointers contain actual disk addresses, and the space is subsequently reused for other files, these dangling pointers may point into the middle of other files."

 



Goals and Principles of domain and language-based protection:

The primary goal is to prevent malicious misuse of the system. The goals and principles of domain and language-based protection is to dictate that the programs, users, and systems are given just enough privileges to perform their tasks with need-to-know access. If given too many privileges, accidental or malicious corruption or loss of data could occur. The System Administrator should have a regular account. The administrator account can grant access for tasks which need the root privileges. A matrix, like the one below, gives programs or domains (left column) permission to perform allowed functions on the objects (and printer) shown in the top row.  Protection systems provide the means for enforcing policies to ensure reliable systems.



How security is used to protect from threats:

Computers, programs, systems, and networks are vulnerable to numerous security threats. These possible security violations include breaches of confidentiality, integrity, and availability, as well as denial of service. Security measures are carried out on four levels to protect systems: physical, human, operating system, and network. Physical security is allowing or denying access to the actual physical equipment. Human security involves allowing login access to systems. This involves keeping passwords secure. Users must protect themselves by learning to identify and avoid phishing schemes and other attempts to gain password information. Operating systems protect themselves from accidental or purposeful security breaches. Network security protects break-ins from outside sources. It protects our systems from trojan horses, viruses, worms, and other security breaches aimed at stealing, corrupting, or deleting passwords, sensitive information, and other files. Operating system and network security are routinely encountering new challenges and must be updated frequently as a result.

 




References

TutorialsPoint. (2020, January 31). Single-threaded and Multi-threaded Processeshttps://www.tutorialspoint.com/single-threaded-and-multi-threaded-processesLinks to an external site.

Williams, L. (2023, January 31). Process Synchronization: Critical Section Problem in OS. Guru99. https://www.guru99.com/process-synchronization.html

GeeksforGeeks. (2023, January 9). Memory Management in Operating Systemhttps://www.geeksforgeeks.org/memory-management-in-operating-system/Links to an external site.

Silberschatz, A., Galvin, P. B., & Gagne, G. (2014). Operating system concepts essentials (2nd ed.). Retrieved from https://redshelf.com/

GeeksforGeeks. (2021, March 9). Protection in OS Domain of Protection Association Authenticationhttps://www.geeksforgeeks.org/protection-in-os-domain-of-protection-association-authentication/Links to an external site.

Operating Systems: Protection. (n.d.). https://www.cs.uic.edu/%7Ejbell/CourseNotes/OperatingSystems/14_Protection.html

 

 

Comments

Popular posts from this blog

Post #7 – Tech Topic Connection