operating systems quiz 1.1
Any solution to the critical section (CS) problem must satisfy the following requirements:
1. Guarantee mutual exclusion: Only one process may be executing within the CS. 2. Prevent lockout: A process not attempting to enter the CS must not prevent other processes from entering the CS. 3. Prevent starvation: A process must not be able to repeatedly enter the CS while other processes are waiting to enter. 4. Prevent deadlock: Multiple processes trying to enter the CS at the same time must not block each other indefinitely.
Why is arranging programs and data to store in main memory permanently not possible on most systems?
1. Main memory is usually too small to store all needed programs and data permanently. 2. Main memory, as mentioned, is volatile—it loses its contents when power is turned off or otherwise lost. Solution: Secondary storage
What is a control program?
A control program manages the execution of user programs to prevent errors and improper use of the computer. It is especially concerned with the operation and control of I/O devices.
What is a device controller?
A device controller maintains some local buffer storage and a set of special-purpose registers. The device controller is responsible for moving the data between the peripheral devices that it controls and its local buffer storage. (disk controller, USB controller, etc.) The CPU and the device controllers can execute in parallel, competing for memory cycles.
The I/O subsystem consists of several components:
A memory-management component that includes buffering, caching, and spooling A general device-driver interface Drivers for specific hardware devices
Network OS
A network operating system is an operating system that provides features such as file sharing across the network, along with a communication scheme that allows different processes on different computers to exchange messages.
Distributed Systems
A network, in the simplest terms, is a communication path between two or more systems. TCP/IP is the most common network protocol
Processor
A physical chip that contains one or more CPUs.
What is a process?
A process is the unit of work in a system.
Traps/Exceptions
A software-generated interrupt caused either by an error (for example, division by zero or invalid memory access) or by a specific request from a user program that an operating-system service be performed by executing a special operation called a system call.
Virtualization
A technology that allows us to abstract the hardware of a single computer (the CPU, memory, disk drives, network interface cards, and so forth) into several different execution environments, thereby creating the illusion that each separate environment is running on its own private computer. These environments can be viewed as different individual operating systems (for example, Windows and UNIX) that may be running at the same time and may interact with each other. A user of a virtual machine can switch among the various operating systems in the same way a user can switch among the various processes running concurrently in a single operating system.
Which of the following is a property of peer-to-peer systems? A) Clients and servers are not distinguished from one another. B) Separate machines act as either the client of the server but not both. C) They do not offer any advantages over traditional client-server systems. D) They suffer from the server acting as the bottleneck in performance.
A) Clients and servers are not distinguished from one another.
A clustered system ____. A) gathers together multiple CPUs to accomplish computational work B) is an operating system that provides file sharing across a network C) is used when rigid time requirements are present D) can only operate one application at a time
A) gathers together multiple CPUs to accomplish computational work
A(n) ________ is the unit of work in a system. A) process B) operating system C) timer D) mode bit
A) process
Embedded computers typically run on a ____ operating system. A) real-time B) Windows XP C) network D) clustered
A) real-time
Protection
Any mechanism for controlling the access of processes or users to the resources defined by a computer system. This mechanism must provide means to specify the controls to be imposed and to enforce the controls.
Storage Hierarchy
As a general rule, there is a trade-off between size and speed, with smaller and faster memory closer to the CPU. Add more here
Why study OS?
As almost all code runs on top of an operating system, knowledge of how operating systems work is crucial to proper, efficient, effective, and secure programming. Understanding the fundamentals of operating systems, how they drive computer hardware, and what they provide to applications is not only essential to those who program them but also highly useful to those who write programs on them and use them.
Which of the following statements concerning open source operating systems is true? A) Solaris is open source. B) Source code is freely available. C) They are always more secure than commercial, closed systems. D) All open source operating systems share the same set of goals.
B) Source code is freely available.
A _____ provides a file-system interface which allows clients to create and modify files. A) compute-server system B) file-server system C) wireless network D) network computer
B) file-server system
Two important design issues for cache memory are ____. A) speed and volatility B) size and replacement policy C) power consumption and reusability D) size and access privileges
B) size and replacement policy
Multitasking
CPU executes multiple processes by switching among them, but the switches occur frequently, providing the user with a fast response time. Consider that when a process executes, it typically executes for only a short time before it either finishes or needs to perform I/O. I/O may be interactive; that is, output goes to a display for the user, and input comes from a user keyboard, mouse, or touch screen. Since interactive I/O typically runs at "people speeds," it may take a long time to complete. Input, for example, may be bounded by the user's typing speed; seven characters per second is fast for people but incredibly slow for computers. Rather than let the CPU sit idle as this interactive input takes place, the operating system will rapidly switch the CPU to another process.
Fault tolerant systems
Can suffer a failure of any single component and still continue operation Fault tolerance requires a mechanism to allow the failure to be detected, diagnosed, and, if possible, corrected.
What are the components of the hardware and what does hardware provide?
Components: The central processing unit (CPU), the memory, and the input/output (I/O) devices Provides the basic computing resources for the system
What does the OS do?
Controls the hardware and coordinates its use among the various application programs for the various users. Provides the means for proper use of hardware, software, and data in the operation of the computer system
As related to process management, the OS is responsible for:
Creating and deleting both user and system processes Scheduling processes and threads on the CPUs Suspending and resuming processes Providing mechanisms for process synchronization Providing mechanisms for process communication
The operating system is responsible for the following activities in connection with file management:
Creating and deleting files Creating and deleting directories to organize files Supporting primitives for manipulating files and directories Mapping files onto mass storage Backing up files on stable (nonvolatile) storage media
What is another term for kernel mode? A) supervisor mode B) system mode C) privileged mode D) All of the above
D) All of the above
__________ is a set of software frameworks that provide additional services to application developers. A) System programs B) Virtualization C) Cloud computing D) Middleware
D) Middleware
The most common secondary storage device is ____. A) random access memory B) solid state disks C) tape drives D) magnetic disk
D) magnetic disk
A ____ can be used to prevent a user program from never returning control to the operating system. A) portal B) program counter C) firewall D) timer
D) timer
Interrupt chaining
Each element in the interrupt vector points to the head of a list of interrupt handlers. When an interrupt is raised, the handlers on the corresponding list are called one by one, until one is found that can service the request. This structure is a compromise between the overhead of a huge interrupt table and the inefficiency of dispatching to a single interrupt handler.
Symmetric multiprocessing
Each peer CPU processor performs all tasks, including operating-system functions and user processes. Each CPU processor has its own set of registers, as well as a private—or local—cache. However, all processors share physical memory over the system bus.
What type of computers and their operating systems and applications are designed primarily to run without user intervention?
Embedded computers
A dual-core system requires each core has its own cache memory. (True/False?)
False
All computer systems have some sort of user interaction. True/False?
False
Security is equivalent to protection with no difference. True/False?
False
The operating system kernel consists of all system and application programs in a computer. True/False?
False
UNIX does not allow users to escalate privileges to gain extra permissions for a restricted activity. True/False?
False
Effective UID is the same as user identifiers (user IDs). True/False?
False Effective UID is the user ID of the owner of the file, rather than the current user's ID.
Program counter specifies the current instruction to execute. True/False?
False, points to the next one
Virtualization software is one member of a class that differs from emulation. True/False?
False. Broadly speaking, virtualization software is one member of a class that also includes emulation.
Goals for OS from the user point of view
For the user, the operating system is designed mostly for ease of use, with some attention paid to performance and security and none paid to resource utilization An increased need for mobile functions like touch screen, etc.
Emulation
Involves simulating computer hardware in software, is typically used when the source CPU type is different from the target CPU type. Ex: Michael forcing Wii games to run on his desktop
Security
It is the job of security to defend a system from external and internal attacks.
Parts of a modern general-purpose computer
- one or more CPUs - a number of device controllers connected through a common bus that provides access between components and shared memory
Tertiary storage
Those that are slow enough and large enough that they are used only for special purposes—to store backup copies of material stored on other devices, for example—are called tertiary storage.
Multiprocessor Systems
Traditionally, such systems have two (or more) processors, each with a single-core CPU. The processors share the computer bus and sometimes the clock, memory, and peripheral devices. - Increased throughput The definition of multiprocessor has evolved over time and now includes multicore systems, in which multiple computing cores reside on a single chip. Including multiple processors.
Flash memory is slower than DRAM but needs no power to retain its contents. True/False?
True
Interrupts may be triggered by either hardware of software True/False?
True
What is a device driver?
Typically, operating systems have a device driver for each device controller. This device driver understands the device controller and provides the rest of the operating system with a uniform interface to the device.
A virtual machine can be switched like a process in the operating system. Yes/No
Yes
Hash collision refers to the phenomenon of hash function in which two unique inputs result in the same output value. Yes/No
Yes
In a binary tree, a parent may have at most two children. Yes/No
Yes
Internet is a network of networks. Yes/No
Yes
VMware application was a virtual machine manager (VMM). Yes/No
Yes
System Programs
associated with the operating system but are not necessarily part of the kernel
Parallelization
divides a program into separate components that run in parallel on individual cores in a computer or computers in a cluster
The main differences among the various storage systems lie in:
speed, size, and volatility.
Firmware
storage that is infrequently written to and is nonvolatile low speed, and so it contains mostly static programs and data that aren't frequently used
Clustered systems
- Gathers together multiple CPUs - Differ from the multiprocessor systems described in Section 1.3.2 in that they are composed of two or more individual systems, or nodes, joined together - Each node is typically a multicore system. - The generally accepted definition is that clustered computers share storage and are closely linked via a local-area network LAN (as described in Chapter 19) or a faster interconnect, such as InfiniBand. - Symmetric and asymmetric
Definition of an OS
- No universally accepted definition - The common functions of controlling and allocating resources are brought together into one piece of software: the operating system. - The one program running at all times on a computer (kernel) - The operating system includes the always-running kernel, middleware frameworks that ease application development and provide features, and system programs that aid in managing the system while it is running.
Goal for OS from the system point of view
- The program most intimately involved with the hardware - functions as a resource allocator for CPU time, memory space, storage space, I/O devices, and so on - operate the computer system efficiently and fairly - a control program - control the various I/O devices and user programs
Which of the following would lead you to believe that a given system is an SMP-type system? A) Each processor is assigned a specific task. B) There is a boss-worker relationship between the processors. C) Each processor performs all tasks within the operating system. D) None of the above
C) Each processor performs all tasks within the operating system.
What statement concerning privileged instructions is considered false? A) They may cause harm to the system. B) They can only be executed in kernel mode. C) They cannot be attempted from user mode. D) They are used to manage interrupts.
C) They cannot be attempted from user mode.
Bluetooth and 802.11 devices use wireless technology to communicate over several feet, in essence creating a ____. A) local-area network B) wide-area network C) small-area network D) metropolitan-area network
C) small-area network
Hadoop
Hadoop is an open-source software framework that is used for distributed processing of large data sets (known as big data) in a clustered system containing simple, low-cost hardware components. Hadoop is organized around the following three components: 1. A distributed file system that manages data and files across distributed computing nodes. 2. The YARN ("Yet Another Resource Negotiator") framework, which manages resources within the cluster as well as scheduling tasks on nodes in the cluster. 3. The MapReduce system, which allows parallel processing of data across nodes in the cluster.
Resource Utilization:
How various hardware and software resources are shared
Single-Processor Systems
If there is only one general-purpose CPU with a single processing core, then the system is a single-processor system. According to this definition, however, very few contemporary computer systems are single-processor systems.
Asymmetric clustering
In asymmetric clustering, one machine is in hot-standby mode while the other is running the applications. The hot-standby host machine does nothing but monitor the active server. If that server fails, the hot-standby host becomes the active server.
Symmetric clustering
In symmetric clustering, two or more hosts are running applications and are monitoring each other. This structure is obviously more efficient, as it uses all of the available hardware. However, it does require that more than one application be available to run.
Multiprogrammed systems
Increases CPU utilization, as well as keeping users satisfied, by organizing programs so that the CPU always has one to execute. In a multiprogrammed system, a program in execution is termed a process. Often, processes may have to wait for some task, such as an I/O operation, to complete. In a non-multiprogrammed system, the CPU would sit idle. In a multiprogrammed system, the operating system simply switches to, and executes, another process. When that process needs to wait, the CPU switches to another process, and so on. Eventually, the first process finishes waiting and gets the CPU back. As long as at least one process needs to execute, the CPU is never idle.
Caching
Information is normally kept in some storage system (such as main memory). As it is used, it is copied into a faster storage system—the cache—on a temporary basis. When we need a particular piece of information, we first check whether it is in the cache.
Types of nonvolatile storage
Mechanical. A few examples of such storage systems are HDDs, optical disks, holographic storage, and magnetic tape. If we need to emphasize a particular type of mechanical storage device (for example, magnetic tape), we will do so explicitly. Electrical. A few examples of such storage systems are flash memory, FRAM, NRAM, and SSD. Electrical storage will be referred to as NVM. If we need to emphasize a particular type of electrical storage device (for example, SSD), we will do so explicitly. Mechanical storage is generally larger and less expensive per byte than electrical storage. Conversely, electrical storage is typically costly, smaller, and faster than mechanical storage.
Middleware
Mobile operating systems often include not only a core kernel but also middleware—a set of software frameworks that provide additional services to application developers Android and iOs both include both a kernel and middleware
The operating system is responsible for the following activities in connection with secondary storage management:
Mounting and unmounting Free-space management Storage allocation Disk scheduling Partitioning Protection
Multicore Systems
Multiple computing cores reside on a single chip. Multicore systems can be more efficient than multiple chips with single cores because on-chip communication is faster than between-chip communication. In addition, one chip with multiple cores uses significantly less power than multiple single-core chips, an important issue for mobile devices as well as laptops. Including multiple computing cores on the same CPU.
There are a fixed number of network protocols. Yes/No
No
A stack is a sequentially ordered data structure that uses the first in, first out (FIFO) principle for adding and removing items. Yes/No
No, LIFO
Is a program by itself a process?
No, it's a passive entity. A process is an active entity.
Two interrupt lines present in most CPUs:
Nonmaskable interrupt, which is reserved for events such as unrecoverable memory errors The second interrupt line is maskable: it can be turned off by the CPU before the execution of critical instruction sequences that must not be interrupted. The maskable interrupt is used by device controllers to request service.
Moore's Law
Predicted that the number of transistors on an integrated circuit would double every 18 months, and that prediction has held true
What is the purpose of application programs?
Purpose: To define the ways in which hardware resources are used to solve users' computing problems. Ex: Word processors, spreadsheets, compilers, and web browsers
RAM
Random Access Memory, main memory Volatile
General purpose computers run most of their programs from:
Rewritable memory, called main memory (also called random-access memory, or RAM). Main memory commonly is implemented in a semiconductor technology called dynamic random-access memory (DRAM)
High-availability service
Service that will continue even if one or more systems in the cluster fail - increased reliability
What is an interrupt?
Signal from hardware or software indicating that an event has occurred or that a process needs attention. Hardware may trigger an interrupt at any time by sending a signal to the CPU, usually by way of the system bus. When the CPU is interrupted, it stops what it is doing and immediately transfers execution to a fixed location. Interrupts must be handled quickly, as they occur very frequently. A table of pointers to interrupt routines can be used instead to provide the necessary speed. (interrupt vector)
Blade servers
Systems in which multiple processor boards, I/O boards, and networking boards are placed in the same chassis. The difference between these and traditional multiprocessor systems is that each blade-processor board boots independently and runs its own operating system. Some blade-server boards are multiprocessor as well, which blurs the lines between types of computers. In essence, these servers consist of multiple independent multiprocessor systems.
Basic Interrupt Mechanism
The CPU hardware has a wire called the interrupt-request line that the CPU senses after executing every instruction. When the CPU detects that a controller has asserted a signal on the interrupt-request line, it reads the interrupt number and jumps to the interrupt-handler routine by using that interrupt number as an index into the interrupt vector. It then starts execution at the address associated with that index. The interrupt handler saves any state it will be changing during its operation, determines the cause of the interrupt, performs the necessary processing, performs a state restore, and executes a return_from_interrupt instruction to return the CPU to the execution state prior to the interrupt We say that the device controller raises an interrupt by asserting a signal on the interrupt request line, the CPU catches the interrupt and dispatches it to the interrupt handler, and the handler clears the interrupt by servicing the device. Enables the CPU to respond to an asynchronous event
Non-Uniform Memory Access (NUMA)
The CPUs are connected by a shared system interconnect, so that all CPUs share one physical address space. The advantage is that, when a CPU accesses its local memory, not only is it fast, but there is also no contention over the system interconnect. - Increased latency when a CPU must access remote memory across the system interconnect, creating a possible performance penalty.
Graceful degradation
The ability to continue providing service proportional to the level of surviving hardware
Core
The basic computation unit of the CPU.
CPU Core
The core is the component that executes instructions and registers for storing data locally.
Bootstrap Program
The first program to run on computer power-on, which then loads the operating system Since RAM is volatile, can't be trusted to store this program Instead the computer uses electrically erasable programmable read-only memory (EEPROM) and other forms of firmware
Privileged instructions
The hardware allows privileged instructions to be executed only in kernel mode. If an attempt is made to execute a privileged instruction in user mode, the hardware does not execute the instruction but rather treats it as illegal and traps it to the operating system. The instruction to switch to kernel mode is an example of a privileged instruction. Some other examples include I/O control, timer management, and interrupt management.
CPU
The hardware that executes instructions.
A computer system can be divided roughly into four components:
The hardware, the operating system, the application programs, and a user We can also view a computer system as consisting of hardware, software, and data.
Interrupt priority levels
The interrupt mechanism also implements a system of interrupt priority levels. These levels enable the CPU to defer the handling of low-priority interrupts without masking all interrupts and makes it possible for a high-priority interrupt to preempt the execution of a low-priority interrupt.
What is a file?
The logical storage unit
Secondary Storage
The main requirement for secondary storage is that it be able to hold large quantities of data permanently. The most common secondary-storage devices are hard-disk drives (HDDs) and nonvolatile memory (NVM) devices, which provide storage for both programs and data. Most programs (system and application) are stored in secondary storage until they are loaded into memory. Much slower than main memory
