Skip to ContentGo to accessibility pageKeyboard shortcuts menu
OpenStax Logo

Summary

6.1 What Is an Operating System?

  • An operating system (OS) is at the core of all of the connected hardware and software.
  • Improving efficiency results in speeding up the implementation of applications from coding time and runtime standpoints. OSs have a large influence because of the abstractions/interfaces they implement.
  • Operating systems provide both mechanism and policy. Mechanism refers to a set of activities that you can do. Policy is how to use the mechanism in specific situations.
  • Virtualization in an operating system allows the system to run different applications that are handled by multiple users at a time on the same computer.
  • Server virtualization places a software layer called a hypervisor (e.g., virtual machine monitor or VMM) between a machine (e.g., server) hardware and the operating systems that run on it.
  • Using OS-level or server virtualization allows a server to run different types of operating systems at the same time on the same computer.
  • The OS translates from the hardware interface to the application interface and provides each running program with its own process.
  • A process consists of address space, one or more threads of control executing in that address space, and additional system state associated with it. The thread is a path of execution within a process and a process may contain multiple threads.
  • The instruction set architecture (ISA) defines a set of instructions that can be used to write assembly language programs that use the CPU while abstracting the hardware details from the program.
  • OS functions guarantee protection, isolation, and sharing of resources efficiently via resource allocation and communication.

6.2 Fundamental OS Concepts

  • An OS manages computer resources (hardware) and provides services for computer programs (software).
  • An OS is a complex system and executes many kinds of activities ranging from executing users’ programs, to running background jobs or scripts, to completing system programs.
  • Processing involves a program, a process, and a processor. An OS is responsible for managing processes, and different OSs approach process management in different ways.
  • The address space is the set of addresses generated by programs as they reference instructions and data. The memory space holds the actual main memory locations that are directly addressable for processing.
  • Computer memory consists of two main types: primary and secondary memory. An OS manages memory space through memory allocation and memory deallocation as well as by maintaining mappings from virtual addresses to physical and switching CPU context among addresses spaces.
  • Device drivers are the routines that interact directly with specific device types and related hardware to indicate how to initialize the device, request I/O, and handle interrupts or errors.
  • A device register is the interface a device presents to a programmer, whereas each I/O device appears in the physical address space of the machine as a few words.
  • In an OS, it is important to have dual mode operations to ensure a high level of security and authority. The dual mode is responsible for separating the user from the kernel mode.
  • Successful OS designs have had a variety of architectures, such as monolithic, layered, microkernels, and virtual machine monitors. As the design of an OS—and even its role—are still evolving, it is simply impossible today to pick one “correct” way to structure an OS.
  • A monolithic OS design is an OS architecture where the entire OS is working in kernel space.
  • A layered OS architecture consists of implementing the OS as a set of layers where each layer exposes an enhanced virtual machine to the layer above.
  • Hardware abstraction layer (HAL) is an example of layering in modern OSs. It allows an OS to interact with a hardware device at a general or abstract level rather than going deep into a detailed hardware level, which improves readability.
  • In a microkernel OS architecture, the functionality and capabilities are added to a minimal core OS.

6.3 Processes and Concurrency

  • Concurrent processing is a computing model that improves performance when multiple processors are executing instructions simultaneously.
  • A process consists of at least an address space, a CPU state, and a set of OS resources.
  • The OS’s process namespace particulars depend on the specific OS, but in general, the name of a process is called a PID (process ID), which is a set of unique numbers that identify processes.
  • The OS maintains a data structure to keep track of a process state, which is called the process control block (PCB) or process descriptor.
  • Concurrency refers to multiple activities and processes happening at the same time. An OS can achieve concurrent processing via the use of threads or one of three different processing environments: multiprogramming, multiprocessing, or distributed processing.
  • Scheduling is the act of determining which process is in the ready state and should be moved to the running state when more resources are requested than can be granted immediately, and in which order the requests should be serviced.
  • A good scheduling algorithm minimizes response time, efficiently utilizes resources, and implements fairness by distributing CPU cycles equitably. Four simple scheduling algorithms are FCFS, RR, STCF, and SRPT.
  • Synchronization is a way of coordinating multiple concurrent activities that use a shared state.
  • Allocation is a method that defines how data is stored in the memory by providing a set of requests for resources and identifying which processes should be given which resources to make the most efficient use of the resources. There are three main forms of allocation: contiguous allocation, linked allocation, and indexed allocation.

6.4 Memory Management

  • The OS loads executable files into memory, allows several different processes to share memory, and provides facilities for processes to exceed the memory size after they have started running.
  • Memory multiplexing is dividing the capacity of the communication channel into multiple logical channels.
  • There are several concepts that are critical to memory multiplexing, namely, isolation, sharing, virtualization, and utilization.
  • Time slicing is a time frame for each process to run in a preemptive multitasking CPU such that each process will be run every single time slice.
  • Sharing means that multiple processes can share the same piece of data concurrently.
  • Memory sharing improves the performance of the system because the data is not copied from one address space to another, so memory allocation is done only once.
  • Virtualization is a technique that gives an application the impression that it has its own logical memory and that it is independent from the available physical memory.
  • Fragmentation is a problem where the memory blocks cannot be allocated to the processes due to their small individual size and the distribution of sizes in the pool; there might be enough total free memory to satisfy the demand, but the available chunks cannot be allocated contiguously.
  • Linkers combine many separate pieces of a program, reorganize storage allocation so that all the pieces can fit together, and touch up addresses so that the program can run under the new memory organization.
  • There are two basic operations used in dynamic storage management to manage a memory or storage to satisfy various needs: allocate a block with a given number of bytes or free a previously allocated block.
  • Virtual memory is a key component of the operating system for ensuring process isolation by guaranteeing that each process gets its own view of the memory.

6.5 File Systems

  • A file system is responsible for defining file names, storing files on a storage device, and retrieving files from a storage device.
  • File systems define operations on objects such as create, read, and write, and they may also provide higher-level services, such as accounting and quotas, incremental backup indexing or search, file versioning, and encryption.
  • File systems are concerned with lower-level characteristics such as performance and failure resilience.
  • The file system interface defines standard operations such the creation and deletion of files (or directories), manipulation of files and directories, copy, and lock.
  • File systems are responsible for managing parts of the disk that are used (inodes) and parts of the disk that are not used (free blocks).
  • A distributed file system (DFS) is a file system that is distributed on multiple file servers or multiple locations that support network-wide sharing of files and devices.
  • A DFS provides an abstraction over physical disks that is akin to the abstraction that virtual memory provides over physical memory.

6.6 Reliability and Security

  • We consider an OS to be reliable if it delivers service without errors or interruptions.
  • Protection is a general mechanism used throughout the OS and for all resources needed to be protected such as memory, processes, files, devices, CPU time, and network bandwidth.
  • There are three aspects to a protection mechanism: authentication, authorization, and access enforcement.
  • The traditional way of authentication involves a password, which is a secret piece of information used to establish the identity of a user and should be relatively long and hard to guess. Another form of authentication is two-factor authentication, which involves two factors: the system calls or texts a user’s phone for the traditional password during login, employing the cell phone as a key.
  • The authorization determines the relationship between principals, operations, and objects by defining which principals can perform which operations on which objects.
  • An access control list (ACL) is a list of rules that specifies which users are granted access to a specific object or resource.
  • A capability list is a list of objects and operations for each user that defines the user rights and capabilities.
  • To support access enforcement, one part of the OS must be responsible for enforcing access controls and protecting authentication and authorization information.
  • There are many advantages to using logging: recovery is much faster; it eliminates inconsistencies; a log can be localized in one area of disk, which makes log writes faster; and it results in better performance. One of the disadvantages of logging is that synchronous disk write happens before every metadata operation.
  • Virtual machines have become a fundamental component of cloud computing, as they allow cloud providers to offer scalable and flexible computing resources to users on a pay-as-you-go basis.
Citation/Attribution

This book may not be used in the training of large language models or otherwise be ingested into large language models or generative AI offerings without OpenStax's permission.

Want to cite, share, or modify this book? This book uses the Creative Commons Attribution License and you must attribute OpenStax.

Attribution information
  • If you are redistributing all or part of this book in a print format, then you must include on every physical page the following attribution:
    Access for free at https://openstax.org/books/introduction-computer-science/pages/1-introduction
  • If you are redistributing all or part of this book in a digital format, then you must include on every digital page view the following attribution:
    Access for free at https://openstax.org/books/introduction-computer-science/pages/1-introduction
Citation information

© Oct 29, 2024 OpenStax. Textbook content produced by OpenStax is licensed under a Creative Commons Attribution License . The OpenStax name, OpenStax logo, OpenStax book covers, OpenStax CNX name, and OpenStax CNX logo are not subject to the Creative Commons license and may not be reproduced without the prior and express written consent of Rice University.