1. A Tour of Computers Systems Flashcards

0
Q

All information stored in computers are bits. How they can be distinguished?

A

Context. Example: a ASCII file can be correctly understood by a text editor, but not by a database.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
1
Q

How the compilation system works?

A

Compilation system works in four phases:

  1. Preprocessing phase. The preprocessor (cpp) modifies the original C program according to directives that begin with the # character. For example, the #include command in line 1 of hello.c tells the preprocessor to read the contents of the system header file stdio.h and insert it directly into the program text. The result is another C program, typically with the .i suffix.
  2. Compilation phase. The compiler (cc1) translates the text file hello.i into the text file hello.s, which contains an assembly-language program. Each statement in an assembly-language program exactly describes one low-level machine-language instruction in a standard text form. Assembly language is useful because it provides a common output language for different compilers for different high-level languages. For example, C compilers and Fortran compilers both generate output files in the same assembly language.
  3. Assembly phase. Next, the assembler (as) translates hello.s into machine language instructions, packages them in a form known as a relocatable object program, and stores the result in the object file hello.o. The hello.o file is a binary file whose bytes encode machine language instructions rather than characters. If we were to view hello.o with a text editor, it would appear to be gibberish.
  4. Linking phase. Notice that our hello program calls the printf function, which is part of the standard C library provided by every C compiler. The printf function resides in a separate precompiled object file called printf.o, which must somehow be merged with our hello.o program. The linker (ld) handles this merging. The result is the hello file, which is an executable object file (or simply executable) that is ready to be loaded into memory and executed by the system.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Describe an overview of a hardware organization of a system.

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Which is the main purpose of buses?

A

Buses are typically designed to transfer fixed-sized chunks of bytes known as words.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Explain the concept of I/O devices.

A

Input/output (I/O) devices are the system’s connection to the external world. Our example system has four I/O devices: a keyboard and mouse for user input, a display for user output, and a disk drive (or simply disk) for long-term storage of data and programs. Initially, the executable hello program resides on the disk.

Each I/O device is connected to the I/O bus by either a controller or an adapter. The distinction between the two is mainly one of packaging. Controllers are chip sets in the device itself or on the system’s main printed circuit board (often called the motherboard). An adapter is a card that plugs into a slot on the motherboard.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Explain the concept of main memory.

A

Physically, main memory consists of a collection of dynamic random access memory (DRAM) chips. Logically, memory is organized as a linear array of bytes, each with its own unique address (array index) starting at zero.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Explain the concept of processor.

A

The central processing unit (CPU), or simply processor, is the engine that interprets (or executes) instructions stored in main memory. At its core is a word-sized storage device (or register) called the program counter (PC). At any point in time, the PC points at (contains the address of) some machine-language instruction in main memory.

From the time that power is applied to the system, until the time that the power is shut off, a processor repeatedly executes the instruction pointed at by the program counter and updates the program counter to point to the next instruction. A processor appears to operate according to a very simple instruction execution model, defined by its instruction set architecture. In this model, instructions execute in strict sequence, and executing a single instruction involves performing a series of steps. The processor reads the instruction from memory pointed at by the program counter (PC), interprets the bits in the instruction, performs some simple operation dictated by the instruction, and then updates the PC to point to the next instruction, which may or may not be contiguous in memory to the instruction that was just executed.

There are only a few of these simple operations, and they revolve around main memory, the register file, and the arithmetic/logic unit (ALU). The register file is a small storage device that consists of a collection of word-sized registers, each with its own unique name. The ALU computes new data and address values. Here are some examples of the simple operations that the CPU might carry out at the request of an instruction:

  • Load: Copy a byte or a word from main memory into a register, overwriting the previous contents of the register.
  • Store: Copy a byte or a word from a register to a location in main memory, overwriting the previous contents of that location.
  • Operate: Copy the contents of two registers to theALU, perform an arithmetic operation on the two words, and store the result in a register, overwriting the previous contents of that register.
  • Jump: Extract a word from the instruction itself and copy that word into the program counter (PC), overwriting the previous value of the PC.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Why cache is important?

A

Cache is used to avoid memory and disk access as possible. A system spends a lot of time moving information from on place to another. The machinhe instructions in the hello program are originally stored on disk. When the program is loaded, they are copied to main memory. As the processor runs the program, instructions are copied from main memory into the processor. Similarly, the data string “hello, world\n”, originally on disk, is copied to main memory, and then copied from main memory to the display device.

A processor can access cache 100 times faster than the main memory.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Which are the most common types of cache memory?

A

L1, L2 and L3 caches. L1 cache on the processor chip holds tens of thousands of bytes and can be accessed nearly as fast as the register file. A larger L2 cache with hundreds of thousands to millions of bytes is connected to the processor by a special bus. It might take 5 times longer for the process to access the L2 cache than the L1 cache, but this is still 5 to 10 times faster than accessing the main memory. The L1 and L2 caches are implemented with a hardware technology known as static random access memory (SRAM). Newer and more powerful systems even have three levels of cache: L1, L2, and L3.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Explain the concept of locality.

A

The idea behind caching is that a system can get the effect of both a very large memory and a very fast one by exploiting locality, the tendency for programs to access data and code in localized regions. By setting up caches to hold data that is likely to be accessed often, we can perform most memory operations using the fast caches.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

In a “Hello, Word!” program, we don’t access the keyboad, display, disk or main memory directly. How this is possible?

A

Because all the needed services were delivered by the operating system.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Which are the primary purpouses of the operating system?

A

The two main purposes are:

  1. To protect the hardware from misuse by runaway applications, and
  2. To provide applications with simple and uniform mechanisms for manipulating complicated and often wildly different low-level hardware devices.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How a operating system can be represented?

A

We can think of the operating system as a layer of software interposed between the application program and the hardware, as shown in figure. All attempts by an application program to manipulate the hardware must go through the operating system.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Which ara the fundamental abstractions used by the operating system?

A

The fundamental abstractions are processes, virtual memory, and files. As the figure suggests, files are abstractions for I/O devices, virtual memory is an abstraction for both the main memory and disk I/O devices, and processes are abstractions for the processor, main memory, and I/O devices.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is a process?

A

A process is the operating system’s abstraction for a running program. Multiple processes can run concurrently on the same system, and each process appears to have exclusive use of the hardware. By concurrently, we mean that the instructions of one process are interleaved with the instructions of another process. In most systems, there are more processes to run than there are CPUs to run them.

When a program such as hello runs on a modern system, the operating system provides the illusion that the program is the only one running on the system. The program appears to have exclusive use of both the processor, main memory, and I/O devices. The processor appears to execute the instructions in the program, one after the other, without interruption. And the code and data of the program appear to be the only objects in the system’s memory. These illusions are provided by the notion of a process, one of the most important and successful ideas in computer science.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is a process context?

A

The operating system keeps track of all the state information that the process needs in order to run. This state, which is known as the context, includes information such as the current values of the PC, the register file, and the contents of main memory.

16
Q

What is context switching?

A

At any point in time, a uniprocessor system can only execute the code for a single process. When the operating system decides to transfer control from the current process to some new process, it performs a context switch by saving the context of the current process, restoring the context of the new process, and then passing control to the new process. The new process picks up exactly where it left off. The Figure 1.12 shows the basic idea for our example hello scenario.

There are two concurrent processes in our example scenario: the shell process and the hello process. Initially, the shell process is running alone, waiting for input on the command line. When we ask it to run the hello program, the shell carries out our request by invoking a special function known as a system call that passes control to the operating system. The operating system saves the shell’s context, creates a new hello process and its context, and then passes control to the new hello process. After hello terminates, the operating system restores the context of the shell process and passes control back to it, where it waits for the next command line input.