Midterm Flashcards
Draw Von Neumann architecture of a computer.
Make drawing.
A von Neumann architecture consists of five basic components:
A central processing unit (CPU) A control unit A main memory system Input devices Output devices
The key feature of von Neumann machines is that they can carry out sequential instructions.
What are the two main characteristics of an OS?
Efficiency and convenience.
The two main characteristics of an OS is that is strives to make the computer efficient and convenient. This means that the OS executes user programs and makes solving user problems easier; it makes the computer system convenient to the user, and it uses the hardware in an efficient manner.
An OS can either focus on one or both of these characteristics. E.g., a mobile device is very convenient, but not very efficient (compared to mainframes, which are very efficient, but perhaps not very convenient).
For networked distributed computing, the networks are categorized into four groups in terms of the distance between members. What are these four types of networks?`
WAN - Wide Area Network
LAN - Local Area Network
MAN - Metropolitan Area Network
PAN - Personal Area Network
Computing environments, in terms of the role of connected members of a network, are divided into two types. What are these two types of networks?
Peer-to-peer
Client-server
What is the difference between emulation and virtualization?
Short answer: Emulation is used when the source CPU (physically present) is different from the target CPU type (the CPU that the program is compiled for). E.g., Apple desktops switched from IBM CPU to Intel CPU and old software used Rosetta to run on an emulated IBM CPU. Virtualization allows a guest OS to run as an application on a host OS.
Virtualization is a technique that allows operating systems to run as applications within other operating systems, but on the same CPU. This method works rather efficiently because the applications were compiled for the same instruction set as the target system uses. But, if you have an application or operating system that needs to run on a different CPU, then it will be necessary to translate all of the source CPU’s instructions so that they are turned into equivalent instructions for the target CPU. Such an environment is no longer virtualized but rather is fully emulated.
What is the difference between “full virtualization” and “para-virtualization”?
Short answer: In full virtualization, the guest is an original OS and wants to manage the memory and perform protection, etc. In para-virtualization, guest OS is designed to run as a guest in a virtual environment and is aware of other operating systems and knows its limitations.
Para-virtualization is a technique in which the guest operating system is modified to work in cooperation with the VMM to optimize performance. In contrast, in full virtualization, the guest OS is unaware that it is in fact being run on a VMM.
What are the three types of cloud computing?
Cloud computer delivers computing, storage and apps as a service across a network. Cloud computing is a logical extension of virtualization because it uses virtualization as the base for its functionality. There are three types of cloud computing:
Public cloud: The public cloud is available via internet to anyone who’s willing to pay.
Private cloud: Is run by a company for the company’s own use.
Hybrid cloud: Includes both public and private components.
What are the three advantages of a multiprocessor system over a single processor?
Short answer:
1. Increased throughput; 2. Lower cost than using a collection of single processors; 3. Reliability is higher, and the system is more fault tolerant.
Multiprocessor systems is growing in use and importance. They are also known as parallel systems or tightly-coupled systems. Advantages over a single processor system include:
INCREASED THROUGHPUT. By increasing the number of processors, we expect to get more work done in less time. The speed-up ratio with N processors is not N, however, because with additional processors comes the overhead of getting them to work together correctly.
ECONOMY OF SCALE (multiprocessor systems can cost less than equivalent multiple single-processor systems)
INCREASED RELIABILITY. If functions can be distributed properly among several processors, then the failure of one processor will not halt the system, only slow it down. This increased reliability is crucial in many applications. The ability to continue providing service proportional to the level of surviving hardware is called graceful degradation. Some systems go beyond graceful degradation and are called fault tolerant, because they can suffer a failure of any single component and still continue operation.
What is the difference between “symmetric” and “asymmetric” multiprocessors?
Short answer: Asymmetric multiprocessing is a CPU scheduling method, in which all scheduling decisions, I/O processing, and other system activities are handled by a single processor - the master processor. The other processors execute only user code. This is a simple method because only one core accesses the system data structures, reducing the need for data sharing. The downfall of this approach is that the master processor becomes a bottleneck where overall system performance may be reduced. Symmetric multiprocessing is the standard approach for supporting multiprocessors where each processor is self-scheduling.
Asymmetric multiprocessing is when each processor is assigned a specific task. A “boss” processor controls the system; the other processors either look to the boss for instruction or have predefined tasks. The boss processor schedules and allocates work to the worker processors.
Symmetric multiprocessing is when each processor performs all tasks within the operating system. In this system, all processors are peers. Each processor has its own set of registers, as well as a private, or local, cache. However all processors share physical memory. I/O must be carefully controlled to ensure the right data reaches the right processor.
What are the five activities of process management?
The five activities of process management include:
- Creating and deleting both user and system processes
- Suspending and resuming processes
- Providing mechanisms for process synchronization
- Providing mechanisms for process communication
- Providing mechanisms for deadlock handling
A process is a program in execution. A process needs certain resources, including CPU time, memory, files and I/O devices, to accomplish its task. These resources are either given to the process when it is created or allocated to it while it’s running.
What is the difference between program and process?
A program is a passive entity, such as the contents of a file stored on a disk (or simply a collection os instructions). A program in execution, is a process. A process is active.
What is a memory unit exposed to?
- A stream of addresses + read requests
2. A stream of addresses + data and write requests.
How long does one memory access take?
It takes many CPU cycles. AMAT = cache-hit-time + miss rate * miss penalty.
Static RAM (SRAM): 0.5-2.5 ns $2000-5000 per GB Dynamic RAM (DRAM): 50-70 ns; $20-75 per GB Magnetic disk: 5-20 ms; $0.2-2 per GB
Our ideal memory is the access time of SRAM with but with the capacity and cost/GB of the magnetic disk.
How long does one register access take?
It takes one clock cycle (or less).
Registers that are built into the CPU are generally accessible within one cycle of the CPU clock. Most CPUs can decode instructions and perform simple operations on register contents at the rate of one or more operations per clock tick.
What does memory management mean?
Memory management means a system that determines what is in memory and when. It is a system that optimizes CPU utilization and the computer’s overall response to users.
What does memory management do?
The operating system is responsible for the following activities in connection with memory management:
- Keeping track of which parts of memory are currently being used and who is using them.
- Deciding which processes (or parts of processes) and data to move into and out of memory
- Allocating and deallocating memory space as needed
What is memory hierarchy?
Short answer: Creating a pyramid with slow, cheap and large memory at the bottom and placing fast, expensive and small memories at the top.
A memory hierarchy consists of a pyramid of different kinds of memories. At the top, closest to the CPU, is the cache. This is a relatively small, but very fast memory. Under the cache (there can be multiple levels of cache) is the main memory (DRAM). Cache and DRAM are both volatile storage, which means that they do not keep their data when they don’t have access to power. Beneath the DRAM is where the secondary non-volatile type of storage begins. The first layer is often the sold-state disk, then magnetic disk, the optical disk.
What is locality of reference?
Locality of reference is referring to the fact that when we access a memory address, we often want to access the same address soon again, or an address close to the current address.
What is the effect of “low” locality of reference?
Low locality causes high miss rate, which forces the memory management to refer to slower parts of the hierarchy.
25‐ Suppose reading one word from the main memory takes 50 clks and reading one block of words from memory would take 100 clks. Also, assume that reading one word from cache would take 2clks. What should be the maximum cache “miss rate” for this memory system to worth having the cache rather than directly accessing the main memory?
AMAT = hit rate + miss rate * miss penalty
50 = 2 + x * 100
48 / 100 = x
x = 48%
A 48% miss rate is the maximum miss rate for this memory system to worth having the cache rather than directly accessing the main memory.
What are the primary and secondary memory layers?
The primary volatile storage includes the registers, cache and main memory. The secondary non-volatile storage includes storage that keeps the data even if the power is turned off, e.g., solid state disk, magnetic disk, optical disks, etc.
What are the four categories of memories in terms of “access type?”
RAM - Random Access Memory
SAM - Sequential Access Memory
DASD - Direct Access Storage Device
CAM - Content-Addressable Memory
What is the “inclusion principle” in the context of the memory hierarchy?
The inclusion principle in the context of the memory hierarchy is that everything in level i is included in level i + 1.
What are the four policies or questions in the management of a memory hierarchy?
- Where can a block be placed? (block placement)
- How is a block found if it is in the upper level? (block identification)
- Which block should be replaced on a miss? (replacement strategy)
- What happens on a write? (write strategy)
Thus, the four policies are: block placement, block identification, replacement strategy and write/update strategy.
What is “mapping” in the context of memory management?
Mapping in the context of memory management is the conversion of virtual addresses to physical addresses.
What is “address binding?”
Short answer: As a general definition, binding means mapping from one address space to another. Traditionally, binding is categorized into three groups: compile-time-binding, load-time-binding and execution-time-binding.
Address binding is the process a program goes through before being executed. In the source program, addresses are usually symbolic. The compiler then binds the symbolic addresses to relocatable addresses. The linkage editor or loader then binds these relocatable addresses into absolute addresses.
Explain why load-time binding is not relocatable and why execution-time binding is relocatable?
His answer:
Load-time binding: The compiler translates symbolic addresses to relative (relocatable) addresses. If it is not known at compile time where the process will reside in memory, then the compiler must generate relocatable code. The loader translates these to absolute addresses. This is done once, and swapping cannot be performed, which makes the method static.
Execution-time binding: If the process can be moved during its execution from one memory segment to another, then binding must be delayed until run time. The absolute addresses are generated by the hardware. Most general-purpose OSs use this method.
Static binding means locations are determined before execution. Dynamic binding means locations are determined during execution.
Load-time binding is not relocatable because the final binding was created when the program was loaded for execution. Execution-time binding is relocatable because the final binding is delayed until runtime, because the program may move from one memory segment to another during execution time.
What are logical and physical addresses?
Logical address – addresses generated by a program and sent to the CPU; also referred to as virtual address. Physical address – address seen by the memory unit which are assigned to a program depending on where the program resides in the main memory.
What is the job of the memory management unit (MMU)?
The memory management unit’s (MMU) job is to map logical addresses to physical addresses at runtime.
What are the minimum hardware requirements of an MMU for dynamic relocation?
The minimum hardware requirements of an MMU for a dynamic relocation is to have a relocation register.
Which type of program benefits most from dynamic relocation? What is the 20-80 rule?
In some programs, a significant portion of the code is used for rare cases, and only a small piece of the code is frequently used. For such applications, dynamic relocation can be used efficiently. Such applications are known as 20-80, which means that 20% of the code is used 80% of the time.
What is a stub?
Short answer: Stub is a small piece of code, which is used to locate the appropriate memory-resident library routine. The stub replaces itself with the address of the routine, and executes the routine.
With dynamic linking, a stub is included in the image for each library-routine reference. The stub is a small piece of code that indicates how to locate the appropriate memory-resident library routine, or how to load the library if the routine is not already present. When the stub is executed, it checks to see whether the routine is already in memory. If not, the program loads the routine into memory. Either way, the stub replaces itself with the address of the routine and executes the routine. Thus, the next time that particular code segment is reached, the library routine is executed directly, incurring no cost for dynamic linking. Under this scheme, all processes that use a language library execute only one copy of the library code.
What is contiguous allocation of memory?
Contiguous allocation means allocating a contiguous region of the main memory to a program.
In contiguous memory allocation, each process is contained in a single section of memory that is contiguous to the section containing the next one.
Why is segmentation considered contiguous and paging is considered non-contiguous?
Segmentation allocates one piece of memory, called segment, to one program. In paging, different parts of the memory, called pages, could contain a part of a program. These pages could be non-contiguous.
Segmentation is considered contiguous because the entire process is kept together in one sequence in memory, whereas with paging, the user process can be split up and may not be necessarily stored sequentially.
What are the elements of the two-tuple that a segment is referred by?
segment-number, offset
What are the minimum hardware requirements in a multiprogram system to ensure each process only accesses its own memory space? Draw a simple block diagram for this protection system.
You need base register and limit register to ensure that each program only accesses its own memory space.
CPU must check every address generated in user mode to be sure it’s between base and limit for that user. The base and limit registers can only be loaded by the operating system, which uses a special privileged instruction.
What strategies are possible for “placement policy” in a “dynamic allocation” memory system?
There are three strategies for placement policy in a dynamic allocation memory system:
First-fit: the process is allocated to the first hole that fits
Best-fit: the process is allocated to the smallest hole that can contain the process
Worst-fit: the process is allocated to the largest hole available
For best-fit and worst-fit, all holes must be searched, unless they are ordered by size.
What are the two types of memory fragmentation?
There is external fragmentation, which can occur with segmentation - when there are lots of little holes between processes. Internal fragmentation occurs within paging, where a process can take up part of a page but not the entire page.
Which type of fragmentation occurs in the contiguous allocation system of the type segmentation?
External fragmentation occurs in between segments.
True or false? The 50-percent rule states that 50% of memory is lost to external fragmentation when the first-fit policy is used. Explain your answer.
False. Statistical analysis of first-fit, reveals that, even with some optimization, given N allocated blocks, another 0.5N blocks will be lost to fragmentation. That is, one-third of memory may be unusable. This property is known as the 50-percent rule.
What is a solution for memory fragmentation? What are the prerequisites of such a remedy and what are the problems?
Short answer: compaction is the solution. It requires that the code and data be relocatable.
One of the solutions to external fragmentation is compaction. The goal is to shuffle the memory contents so as to place all free memory together in one large block. Compaction is not always possible, however. If relocation is static and done at assembly or load time, compaction cannot be done. Compaction is only possible if relocation is dynamic and is done at execution time. If addresses are relocated dynamically, relocation requires only moving the program and data and then changing the base register to reflect the new base address. When compaction is possible, we must determine its cost. The simplest compaction algorithm is to move all processes toward one end of memory; all holes move in the other direction, producing one large hole of available memory - but this scheme can be expensive.
Another problem concerns I/O. You could refuse to move a program while it’s involved in I/O or you could have a system where I/O only goes into OS buffers.
What is the difference between a “frame” and a “page”?
Frame and page are of the same size. A frame is referred to as a physical piece of memory, and a page is referred to as the virtual address space.
Frames is what the physical memory is divided into. Pages is what virtual memory is divided into.
What is the job of a page table?
It contains a translation (mapping) of virtual to physical addresses.
The job of a page table is to keep the frame numbers associated with each virtual address. The page table helps translate logical to physical addresses.