Computers & The Internet Flashcards

1
Q

What is an OS?

A

An operating system (OS) is a program that controls the execution of application programs and acts as an interface between applications and the computer hardware.

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

What are the objectives of an OS

A

It needs to be convenient, efficient, and have the ability to evolve.

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

What services do the operating system provide?

A

File management, input/output management, process management, memory management, and multiprocessor management.

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

What is the kernel?

A

The most central part of the OS. Its functionality depends on the OS design.

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

What is a kernel context switch?

A

Transition between user mode and kernel mode, they are computationally expensive (i.e. require a lot of CPU usage) therefore an OS tried to limit the number of context switches.

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

What is a monolithic OS structure?

A

All services are implemented by a large kernel, any new feature is added to the kernel, “everything is connected to everything”.

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

What are the pros and cons of a monolithic OS structure?

A

Pros – Communication with kernel is fast; Cons – Difficult to understand, difficult to modify, lack of security.

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

What is a layered OS structure?

A

Services are implemented by a large kernel which is organised into layers. Each layer can only communicate with adjacent layers, and any given layer only needs to know the functionality of adjacent layers.

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

What are the pros and cons of a layered OS structure?

A

Pros – It is easy to debug; Cons – Poor performance due to requiring traversal through multiple layers to obtain a service.

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

What is a microkernel OS structure?

A

Services are implemented by servers, and a small kernel delivering messages between them.

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

What are the pros and cons of microkernel OS structure?

A

Pros – Secure and reliable; Cons – Poor performance due to increased system-function overhead.

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

What is a modular OS structure?

A

Starts with a small kernel and additional services are loaded on demand via modules.

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

What are the pros and cons of a modular OS structure?

A

Pros – Fast because we don’t load unnecessary services and any module can directly communicate with any other module; Cons – As more modules are loaded it becomes similar to monolithic structure.

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

What is a virtual machine?

A

A host operating system provides virtual hardware to one or multiple guest OS’s. Enables multiple environments with different OS’s on one machine.

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

What is a file?

A

A file is a named collection of related information that is recorded on secondary storage (non-volatile memory). File extensions help the OS determine how to interpret the file.

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

What are the attributes of a file?

A

Typical file attributes include: The name of the file, the identifier of the file, the location of the file on a storage device, the size of the file, the protection mode of the file (permissions), and the times when the file was created, accessed and modified.

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

How does file management work in linux?

A

In Linux everything is represented by a file in the file system. There are six types of files: Regular files, directories, special files, pipes, links, and symbolic links. There is also a tree-like inode pointer structure.

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

What are hard and soft links?

A

Hard links – point to a file via its inode, this means if the file is moved/deleted the link will still work. Soft (symbolic) links – pointer to a filename, this means if the file is moved/deleted the link will still work.

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

What are blocks?

A

In Linux, files are allocated in blocks, with each block typically being 4096 bytes.

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

What is the Inode Pointer Structure?

A

This is used by the inode of a file to list the addresses of files data blocks. This consists of fifteen pointers, twelve of which point directly to blocks of the file’s data (direct pointers). Then there is a single indirect pointer (a pointer that points to a block of pointers that then point to blocks of the file’s data), a doubly indirect pointer (a pointer that points to a block of pointers that point to other blocks of pointers that then point to blocks of the file’s data), and a triply indirect pointer (a pointer that points to a block of pointers that point to other blocks of pointers that point to other blocks of pointers that then point to blocks of the file’s data).

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

What are magnetic disks and how do they work?

A

These are primarily HDD’s but also floppy disks. A magnetic disk has a number of spinning circular platters, over which hover some heads attached to a movable arm. The magnetic disk is read/written by having the head sense/change the magnetism of a sector. At a bit level magnetism in one direction represents a one, and magnetism in the other direction represents a zero. Each platter is divided into circular tracks, and each track is divided into sectors. A set of tracks across different platters at a given position make up a cylinder. Each sector has a fixed amount of data (usually 512 bytes), which is the smallest unit of data you can transfer to or from a disk. A magnetic disk is read/written by moving the arms in/out to the requires cylinder. All heads/arms move together. The platters rotate; the rotation speed is related to the data transfer rate.

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

What are SSDs’ and how do they work?

A

A SSD has no moving parts and instead stores data using flash memory. A SSD has a controller (an embedded processor), buffer memory (volatile memory), and flash memory. A typical SSD might have 4 kB pages and a 512kB block size, which means each block has 128 pages. The act of erasing flash memory requires a high amount of voltage, is rather slow, and can only be done on block level. Reading and Writing is done on page level and is fast to do. Overwriting requires an erase operation, and is therefore slower than reading or writing to an empty drive. A SSD is read by: copying a flash memory page into the buffer and reading data from the page in the buffer. A SSD is written by copying a memory block into the buffer, erasing the block in flash memory, modifying the block in the buffer, and writing the block from the buffer to the flash memory.

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

What are the pros and cons of SSDs’ over Magnetic Disks?

A

SSDs are faster, more reliable, more expensive, and more power efficient than magnetic disks. However SSD’s deteriorate with every write process.

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

What is Wear-Levelling?

A

A block will fail once it reaches a critical number of writes. Wear-levelling spreads out the writes evenly among the blocks. There are two types: Dynamic and Static. It is applied by the controller.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
What is Dynamic Wear-Levelling?
One type of wear-levelling is dynamic wear-levelling. New data is written to the least-recently-used block. Thereby we avoid wearing out certain blocks by writing to the same block again and again. The issue with this is that cold data is not moved.
26
What is Static Wear-Levelling?
This does the same as dynamic wear-levelling, but also periodically moves existing data to the least-recently-used block. Thereby we avoid wearing out certain blocks while blocks with cold data that is never moved.
27
What is an I/O device?
I/O devices enable computers to receive or output information to humans or devices. Examples include human interface devices such as monitors and keyboards, storage devices such as SSD’s and HDD’s, and transmission disks such as network cards. The communication with I/O devices is performed over a bus, and the I/O devices are operated using controllers.
28
What are controller registers?
The processor communicates with the controller by reading and writing to the controller registers. There is the data-in register, which is data coming from the device; the data-out register, which is data going to the device; the status register, which indicates the status of the device; and the control register, which commands the device.
29
What is Port-Based I/O?
The CPU uses special instructions for sending and receiving data to and from an I/O port.
30
What is Memory-Mapped I/O?
The CPU treats the device “as memory”; control registers are mapped to specific memory addresses. This is more commonly used nowadays than port-based I/O.
31
What is polling?
An approach to control. The CPU repeatedly checks the controller’s status register to see whether the controller is busy. When the controller is ready and the CPU wants to give new instructions, the CPU writes to the data-out register and signals that it has done so to the control register.
32
What are Interrupts?
An approach to control. The CPU regularly senses an interrupt-request line. When the CPU gets an interrupt signal through the interrupt-request line, it stops the current process and initiates a response.
33
What are the differences between Polling and Interrupts?
Interrupts can monitor the status of several devices at the same time and serve them based on priority. Polling needs to check each device individually in a round-robin fashion. Interrupts are much more commonly used since this frees the CPU from polling devices that do not need service. Polling may be efficient if the controller and the device are fast, the I/O rate is high, some I/O data can be ignored, and the CPU has nothing better to do.
34
What are large data transfers?
Some devices such as disk drives will often do large data transfers. The transfer will inefficient if the CPU has to feed data, byte to byte, to the controller’s registers. A better approach is to offload this work to a special-purpose processor (a DMA controller).
35
How does Direct Memory Access work?
The CPU writes a command block into memory, specifying the source and destination of the transfer. The DMA can then perform multiple transfers via a single command. When the transfer is complete, the CPU receives an interrupt from the DMA controller. This enables to CPU to spend more resources on other tasks.
36
What is a device driver?
A device driver hides differences between various device controllers by defining an interface between the OS and I/O devices for a specific class of I/O devices.
37
What is a system call?
A system call is a request of kernel service. For example, you can have system calls for character I/O, block I/O and network I/O.
38
What happens in a system call for character I/O?
A character device transfers bytes one by one. Characters must be processed in the order that they arrive in the stream. The interface includes the get operation, to return the next character in the stream; the put operation, to add a character to the stream; and libraries for line-by-line access, with integrated editing services (such as backspace to remove the preceding character from the stream.
39
What happens in a system call for block I/O?
Block devices (typically non-volatile mass storage devices such as HDD’s) are used to transfer blocks of data. The interface includes a read operation, for reading blocks of data; and a write operation, for writing blocks of data. Block devices are high volume devices.
40
What happens in a system call for memory-mapped I/O?
Layered on top of block device drivers. Rather than read and write operations, a memory-mapped interface provides access to disk storage via a location in main memory; there is a system call that maps a file on the device into memory. The OS deals with transferring data between memory and the device and can perform transfers when needed. Accessing memory-mapped files is generally faster than using read/write operations since it does not require a context switch. Memory-Mapped files are not the same as memory-mapped IO.
41
What happens in a system call for network I/O?
A network socket interface has system calls for: - Creating and connecting sockets - Sending and receiving packets over the connection - The select function, for determining the status of one or more sockets (whether the socket is ready for reading and writing). - Checking whether a transfer was successful - Recovering gracefully from unsuccessful transfers. The main difference between network and other I/O devices is that things regularly go wrong with network I/O devices.
42
What is a program?
A set of instructions for performing a specific task. It is stored on disk.
43
What is a process?
A program in execution. It requires CPU resources, primary memory and I/O. There may be multiple processes executing a single program.
44
Why do we need processes?
It makes it easier to build and and maintain the OS as modules can be improved 1 by 1. We can build methods for organising and executing a large number of concurrent processes. It means we can execute tasks in parallel which is faster.
45
What are the elements of the process lifecycle?
Born: A process has been created but not admitted to the pool of executable processes. Ready: When the OS is ready, the process is transferred to the ready state. Running: The process is executed by a processor. It may go back and forth between running and ready depending on priority. Waiting: The process has made a request it has to wait for, such as an input or access to a file. Died: The process has been completed or aborted
46
What is a process control block?
Each process is represented by a PCB. It is stored in memory. It contains the process number (its identity), the process state (its registers; stores temporary results, the next instruction etc), the process address space (its memory) and the process I/O (I/O devices and files allocated to the process).
47
What is a process context switch?
When one process is stopped and another is started. It changes the process scheduling state of A, saves the context of A, loads the context of B, changes the process scheduling state of B. It is pure overhead and the time depends on several factors.
48
What are the issues with process context switches?
With too few of them, there is no fairness between processes and some processes have to wait for a long time. With too many, the processor has to spend too many resources on overhead. The aim is to optimise the number of switches.
49
What does the process address space contain?
A stack for temp data, a heap for dynamically-allocated data, a data section for static data, a text section for program code. The data and text sections are fixed size, while the stack and heap sections can shrink and grow.
50
What is the stack in the process address space?
Whenever a function is called, temporary variables are added to the top of the stack. When exiting a function they are removed from the top of the stack. Push adds a variable and Pop removes a variable. Last in - First out.
51
What is the heap in the process address space?
It is dynamically allocated. Blocks are allocated and removed in an arbitrary order. It's used to store a large block of memory for a longer period of time, and variables that can change size dynamically.
52
What is process spawning?
A process is created at the request of a different process. The first process is called the parent process, and the second is the child process. In linux there are four system calls for process spawning.
53
What is Fork?
Fork creates a child process with a unique process ID. The child is given a copy of the process address space of the parent process. The processes know whether they are child/parent.
54
What is Exec?
Exec runs an executable file that overwrites the process's address space with a new program. This is usually used after the fork process. The use of fork then exec allows the parent and child to communicate but go their separate ways.
55
What is Exec?
Exec runs an executable file that overwrites the process's address space with a new program. This is usually used after the fork process. The use of fork then exec allows the parent and child to communicate but go their separate ways.
56
What is Wait and Exit with parent/child processes?
The parent process is put in a waiting state until the child process has finished. When done the child process issues the exit system call, and the parent process resumes.
57
What is shared memory?
Shared memory is a memory management technique in which multiple processes can access the same block of memory. Memory space from within one processes address space is shared between them. The processes read or write to the shared region. Both processes must make system calls to make the shared space available to both processes.
58
What is message passing?
Processes communicate by sending messages to each other. The messages are sent to/received from an agreed “mailbox” that is not part of the address space of any of the processes.
59
What are the advantages of shared memory and message passing?
Shared memory: faster than message passing because message passing requires system calls. Message Passing: Good for small amount of data, as it avoids setting up the shared space.
60
What is First Come First Served?
The first-come-first-served scheduling algorithm allocates the processor on the basis of creation time (like you queue at a shop with a single queue).
61
What are the pros and cons of First Come First Served?
Pros: No unnecessary switching between processes. You will eventually always provide processing time to a given process. Cons: Long average waiting time.
62
What is Round Robin?
Identical to first come first served, except that no process can occupy the processor longer than a predefined time length (the time quantum). After a arriving at a processor, a process will either 1) be interrupted and placed at the end of the (circular) queue, or 2) complete before it runs out of time.
63
What are the Pros and Cons of Round Robin?
Pros: Distributes resources fairly and quick processes can pass through quick. Cons: Long waiting time when processes require multiple time quanta. Performance depends on time quantum.
64
What is Shortest Process Next?
The shortest process next scheduling algorithm shares the processor on the basis of shortest predicted execution time. It can be preemptive or non-preemtive.
65
What are the pros and cons of Shortest Process Next?
Pros: Gives the minimum average waiting time for a given set of processes. Cons: Execution time has to be estimated, and long processes may have to wait ages.
66
What is multilevel queuing?
It organizes processes into different priority levels or queues, and processes are scheduled for execution based on their priority level. For example there could be specific queues for interactive processes (lots of I/O), normal processes (system services), and batch processes (processes without I/O). Fixed Priority scheduling gives some processes priority. Time slicing gives different CPU time to different processes. Different algorithms may be used for different processes.
67
What are the pros and cons of multilevel queuing?
Pros: Can accommodate a range of different performance objectives. Cons: Complex and difficult to calibrate.
68
What is User-Oriented Criteria?
Focus of performance as perceived by an individual user. This can include turnaround time (time between submission of a process and its completion), and response time (the time between the submission of a process and the first response from the process).
69
What are system oriented criteria?
Focus on efficient utilization of the processor. For example: Throughput (the number of completed processes per unit time) and Processor Utilization (The percentage of time that the processor is busy).
70
What is a multi-core processor?
A processor with several cores/processors. Each core has its own cache memory.
71
What are the two approaches to Multi-Processor Scheduling?
A common ready queue: When a processor comes available it chooses a new process from a common queue. Private queues: When a processor becomes available, it chooses a new process from its own private queue.
72
What is load balancing?
A method of improving the performance of multiprocessor scheduling. It balances processes evenly among processors. Common ready queues automatically have this.
73
What is Processor Affinity?
A method of improving the performance of multiprocessor scheduling. It keeps a process running on the same processor to keep the cache warm. Private queues automatically have this.
74
What are the Memory Management Tasks?
Ability to relocate a process, Protection from other processes and Sharing of data.
75
What is Fixed Partitioning?
Memory is divided into partitions of a fixed size; the size may vary between partitions. A process can be loaded into any partition whose size is equal to or greater than the size of the process. One-to-one mapping between partitions and processes. Suffers from Internal Fragmentation.
76
What is Internal Fragmentation?
When space is wasted inside partitions because the size of the process is smaller than the size of the partition.
77
What are the pros and cons of Fixed Partitions?
Pros: Easy to understand and implement. Cons: Internal Fragmentation, a pre specified limit on the number of processes and the largest process.
78
What is Dynamic Partitioning?
The partition sizes adjust to the sizes of processes. One-to-one mapping between partitions and processes. Suffers from External Fragmentation.
79
What are External Fragmentation and Compaction?
External fragmentation is when space is wasted between partitions. Compaction is when processes are shifted so all the free memory is gathered in one continuous block. This takes a lot of time.
80
What are the pros and cons of Dynamic Partitioning?
Pros: No internal fragmentation. No limit on the number of processes or on the size of the largest process. Cons: External fragmentation. Time is wasted on compaction.
81
What is Simple Segmentation?
Each program is divided into segments (e.g., text and data segments). Segments are loaded into memory as in dynamic partitioning. All segments need to be loaded into memory, but they do not need to be contiguous.
82
What are the pros and cons of Simple Segmentation?
Pros: Easier to fit processes in memory than with dynamic partitioning. No internal fragmentation. No limit on the number of processes or on the size of the largest process. Cons: External fragmentation (less than dynamic partitioning). Time is wasted on compaction.
83
What is Virtual Memory Segmentation?
Use disk storage as if it was main memory. Segments are loaded into memory as in dynamic partitioning, except that not all segments need to be loaded at the same time.
84
What are the pros and cons of Virtual Memory Segmentation?
Pros: Easier to fit processes in memory than with simple segmentation. No internal fragmentation. No limit on the number of processes or on the size of the largest process. Cons: External fragmentation (less than dynamic partitioning). Time is wasted on compaction.
85
What is Simple Paging?
Memory is divided into fixed-size frames of equal size. Each process is divided into pages of the same size. Internal fragmentation is small.
86
What are the pros and cons of Simple Paging?
Pros: No external fragmentation. All pages fit perfectly into frames. Cons: Small internal fragmentation. Each process requires a page table (which consumes memory).
87
What is Virtual Memory Paging?
Pages are loaded into frames as in simple paging, except that not all pages need to be loaded at the same time.
88
What are the pros and cons of Virtual Memory Paging?
Pros: Easier to fit processes in memory than with simple paging. No external fragmentation. All pages fit perfectly into frames. Cons: Small internal fragmentation. Each process requires a page table (which consumes memory). More overhead required for virtual memory.
89
What is the CPU?
The CPU controls the execution of instructions. A CPU will use a specific instruction set architecture, such as ARM or x86.
90
What are Registers?
The CPU stores temporary results in internal registers. When executing a given process, that process’s registers are loaded into the CPU. Some registers are interchangeable general-purpose registers.
91
What are Special-Purpose Registers?
CPU registers used for specific tasks like instruction tracking and memory management. Examples include program counter, stack pointer, link register, and base pointer.
92
What are Base and Stack Pointers?
The base pointer points to the base of the current stack frame, while the stack pointer points to the top of the stack. Together, they are used to keep track of the location of variables and data on the stack.
93
What is the Link Register and Program Counter?
The link register stores the address where to return to when the current function call has completed. The program counter stores the address of the next instruction to be executed.
94
What is the ALU?
The ALU performs simple operations between two input registers (operands) and puts the result in an output register.
95
What is the Status Register?
The current program status register contains status and control bits indicating, for example, the output of the ALU and the mode of the CPU.
96
What is Assembly Language?
Assembly language is a low-level programming language that is used to program a computer's CPU directly. It uses simple instructions but is a difficult programming language.
97
What is branching?
Branch instructions will “jump” to a different instruction. They do so by changing the program counter.
98
What is a word?
A word is 2, 4 or 8 bytes. Each register is word sized. On a 64 bit machine a word is 8 bytes. A byte is 8 bits.
99
What is the Memory Hierarchy?
From fastest to slowest, and smallest to biggest: Registers, Cache, Main Memory, Disks.
100
What is the Main Memory?
When we need more storage than registers we use the main memory (RAM).
101
What are Memory Addresses?
The minimum addressable unit of memory is typically 1 byte (8 bits). A memory with 2n addressable units will need n-bit addresses. Memory addresses are often written in hexadecimal form.
102
What is Cache?
A high-speed memory that stores frequently accessed data for quick retrieval, improving device performance by reducing CPU access to main memory.
103
What is Temporal Locality?
A method for deciding what to store in cache. If an item in memory is referenced, then it is likely to be referenced again soon. When a cache needs to discard data, it tends to first discard data that has not been requested in a long time.
104
What is Spatial Locality?
A method for deciding what to store in cache. If an item in memory is referenced, then it is likely that those nearby will be referenced soon. When a specific memory block is referenced, the cache will often also bring in additional memory blocks located at similar addresses.
105
What are Cache Hits and Misses?
A cache hit is when the data requested is in the cache. A cache miss is when it is not in the cache, so it has to be read from the main memory.
106
What is Direct-Mapped cache?
A memory address is mapped to exactly one cache address.
107
What are the pros and cons of Direct-Mapped Cache?
Pros: Easy to search. Cons: Inefficient use of the cache space.
108
What is Fully-Associative Cache?
In a fully-associative cache, a memory address is mapped to the least-recently-used cache address.
109
What are the pros and cons of Fully-Associative Cache?
Pros: Flexible, can fill the cache with any combination of memory addresses. Cons: Takes a long time to search.
110
What is the S-Way Set-Associative Cache?
The cache is divided into N cache sets. Each cache set can store S memory addresses data. A memory address is mapped to exactly one cache set, and to the least-recently-used cache line in that set.
111
What is the relationship between the different cache designs?
A fully-associative cache with S slots is an S-way set-associative cache — there is 1 set of size S. A direct-mapped cache with S slots is a 1-way set-associative cache — there are S sets of size 1.
112
What is a Write Hit and Miss?
A write hit — the address we want to write to is present in the cache. A write miss — the address we want to write to is not present in the cache.
113
How do you deal with Write Hits?
Write-back — write into cache only. This is faster, but you still need to write to memory before cache data is removed. Write-through — write into both cache and memory. Slower, but means the cache and memory is in sync.
114
How do you deal with Write Misses?
Write around — write into memory only. Avoids unnecessary cache access, but does not use temporal locality. Write allocate — write into memory and read into cache. Uses temporal locality, but potential unnecessary cache access.
115
What is Virtual Memory?
Uses disk storage as if it was main memory.
116
What is Demand Paging?
Only load a page when there is a request for it. More processes can be loaded into memory. However the processor spends most of its resources on swapping pages.
117
What is Pre-Paging?
Guess which pages will be requested and pre-load them. There is less overhead when page predictions are accurate, but resources are wasted on loading unused pages.
118
What is the fetch decode execute cycle?
Fetch — read an instruction from memory Decode — identify the instruction Execute — carry out the instruction
119
What is the difference between pipelined and non-pipelined cycles?
With a non-pipelined fetch-decode-execute cycle, the time required to execute an instruction is the sum of the time required by each stage. With a pipelined fetch-decode-execute cycle, the rate of instruction execution is multiplied by the number of stages.
120
What are Clock Cycle Time, Clock Rate, and Execution Time?
The clock cycle time of a CPU is the time it takes to complete one pipelining stage. Clock speed = 1/clock cycle time. Execution time = Clock cycles for program × Clock cycle time.
121
What is a Control Hazard?
A control hazard occurs when a (conditional) branch instruction changes the next instruction. There are four ways to deal with control hazards: (a) stall the pipeline (b) assume branch not taken (c) branch prediction (d) branch delay slots
122
What is Stalling the Pipeline?
The processor may stall the pipeline; when we realize that the next instruction is a branch instruction, stop the next instructions. We don’t need to guess the next instruction, but time and resources are wasted.
123
What is Assuming Branch Not Taken?
The processor may assume branch not taken, squashing instructions if wrong. We don’t need to guess the next instruction, but time and resources are wasted whenever the branch is taken.
124
What is Branch Prediction?
The processor may try branch prediction based on past branches. If the prediction is incorrect, instructions are squashed. This can significantly reduce the number of wasted clock cycles, but there is overhead associated with branch prediction.
125
What are Branch Delay Slots?
A branch instruction may be followed by delay slots (these are always executed). May find useful instructions, e.g., when paths (taken/not taken) join, but if no useful instruction is found, fill the slot with “No operation” ,
126
What are Data Hazards?
A data hazard occurs when an instruction requires a result from a previous instruction before that result has been computed/written.
127
What are the solutions to Data Hazards?
Stalling the Pipeline and Out-of-order execution.
128
What are the effects of more pipeline stages?
A larger penalty for incorrect branch predictions and a bigger risk of data hazards.
129
How does the Spectre attack work?
To start, array1 is in memory, next to private data belonging to a different process. array1 [ x ], where x is large, is private information. Normally, attempted access to array1 [ x ] will trigger a fault. x is chosen by the attacker, array1_size is uncached, array1[ x ] is cached, array2 is uncached, and a mistrained branch predictor will predict that x < array1 size. Reading array1_size results in a cache miss. While waiting for array1 size, reading array1[ x ] results in a cache hit (validity isn't checked). Reading array2[ array1[ x ] * CACHE LINE SIZE ] results in a cache miss. Once array1 size arrives, the register changes made during speculative execution are rewinded, However, array2[ array1[ x ] * CACHE LINE SIZE ] is left in the cache. A specific element of array2 will be placed in the cache (array1 [ x ] determines which element). Read all memory blocks storing array2, one by on, The block that is accessed quickly is in the cache, the blocks that take a longer time to access are in memory. The location of the cache data is array1[x].
130
What is Meltdown?
To start array1 is in memory, next to private information belonging to a different process or to the kernel. array1 [ x ], where x is large, is private information. Normally, attempted access to array1 [ x ] will trigger a fault. array2 is not in memory (but on disk). The computer is made to do speculative execution. array1 [ x ] is found in memory (validity is not checked), array2[ array1[ x ] * PAGE SIZE ] is not in memory and has to be loaded into memory from disk. array2[ array1[ x ] * PAGE SIZE ] will be left in memory when the exception is caught. Read all pages storing array2, one by one, the page that is accessed quickly is in memory, the pages that take a longer time to access are on disk. The location of the page in memory is array1[x].
131
What are the differences and similarities with Spectre and Meltdown?
Similarities: Exploit built-in vulnerabilities, not bugs. Require attacker to execute on system. Differences: Spectre reads memory from other processes, Meltdown can also read kernel memory from user space.
132
What is parallel computing?
The idea of parallel computing is to increase performance by performing multiple computations in parallel.Parallel computing on multiple levels: Pipelining Threads Multi-core processors Multiprocessors Multicomputers
133
What is a SISD computer?
A Single Instruction, Single Data (SISD) computer has a single instruction stream working on a single data stream.
134
What is a MISD computer?
A Multiple Instruction, Single Data (MISD) computer has multiple instruction streams working on a single data stream. This is not found in modern computers.
135
What is a SIMD computer?
A Single Instruction, Multiple Data (SIMD) computer has a single instruction stream working on multiple data streams. SIMD computers are good for vector operations, including image and audio processing.
136
How does a GPU work?
A Graphics Processing Unit (GPU) utilizes a large number of ALUs to perform parallel processing. A GPU is based on a SIMD architecture. In comparison to CPUs, GPUs have more ALUs and and rely less on cache memories. Therefore, in comparison to CPUs, GPUs have a high throughput and a high latency.
137
What are Threads?
GPUs hide latency by utilizing threads. A process may be subdivided into multiple threads, and threads within a process share data, heap, and code, but have their own registers and stack. A threaded processor runs a thread until blocked by a memory access request, when it switches to another ready thread. Thread switches tend to be faster than process switches.
138
What is a MIMD computer?
A Multiple Instruction, Multiple Data (MIMD) computer has multiple instruction streams working on multiple data streams. This is mainly used in supercomputers.
139
What is a multi-core processor?
A multi-core processor puts multiple CPU cores on one chip. Each core has its own L1 and L2 cache, and they all share L3 cache.
140
What is a multiprocessor?
A multiprocessor puts two or more chips on a board. The processors communicate through shared memory variables. Whenever a processor wants to modify a shared variable, the processor locks the variable so that no other processor can modify it.
141
What is a multicomputer?
A multicomputer puts two or more multiprocessors in a rack. Each multiprocessor has its own copy of the operating system.
142
What is shared and distributed memory?
In shared memory, processors communicate through the shared memory, which is fast. In distributed memory, processors communicate by passing messages which allows for higher bandwidth.
143
What is a sleep state?
Ideally has: Low power consumption and quick recovery to active state based on user input.
144
What is The Advanced Configuration and Power Interface?
Different modes of operation that use different amounts of energy. This can be used for systems, devices and processors.
145
What are the global states?
G0; Powered on; S0; Standard Operation G1; Sleeping; S1; CPU stops running. CPU caches are shut down. Lower power states of hardware devices. G1; Sleeping; S2; CPU powered off. G1; Sleeping; S3; Shut down more devices. Make it harder for devices to wake the system. G1; Sleeping; S4; Save memory to disk and shut down memory. G2; Powered of; S5 G3; Unplugged
146
What are the device states?
D0; Fully operational D1, D2; Intermediate states (optional) D3; Device is off.
147
What are the processor states?
C0; Fully operational C1; The processor stops executing instructions. Caches are maintained. Short wake time. Must wake when receiving an interrupt. C2, C3; Similar to C1 but deeper sleep and longer wake time (optional states). Processor states are applied to individual cores
148
What are the performance states?
A processor could save energy by scaling down the power and clock frequency (P0 ⇒ P1, . . . , P15).
149
What is the issue with Traditional Cloud Data Centres?
Traditional cloud data centres using off-the-shelf components have a Power Usage Effectiveness (PUE) of 2.0, far from a perfect 1.0.
150
What are Hyperscale Cloud Data Centres?
The Open Compute Project is driven by large companies that have an interest in building more efficient data centres. The project shares designs and best practices on data centres at no cost. Hyperscale cloud data centres using Open Compute Project components have a Power Usage Effectiveness (PUE) of 1.2, close to a perfect 1.0. One Open Compute Project server replaces 3.75 traditional ones.
151
What are the five elements of the TCP/IP stack in order?
Application Layer, Transport Layer, Internet Layer, Network Layer, Physical Layer.
152
What are payloads and headers?
Network packets (payload) traverse the protocol stack on each host. Many of the layers add their own headers to the payload which contain supplemental data.
153
What is a host?
A host is a computer connected to a computer network.
154
What is a LAN?
A local area network (LAN) consists of a switching device, to which hosts are directly connected. The risk of failure is relatively small.
155
What is a WAN?
A wide area network (WAN) consists of connected switching devices, to which local area networks are directly connected. The risk of failure is larger than in a LAN.
156
What are switches?
A switch is a special-purpose hardware device dedicated to interconnecting hosts on a wired LAN. Switches route packets based on the media access control (MAC) addresses of the connected devices.
157
What is a MAC address?
A 6 byte long identifier for each device connected to the internet. Every device has a unique permanent address. The first 3 bytes are unique to the manufacturer, and the last 3 are unique to the device.
158
What is MAC address spoofing?
The apparent MAC address may be changed for reasons of privacy, to bypass firewalls, etc.
159
What is a router?
A router is a special-purpose hardware device dedicated to interconnecting networks that may use different technologies. Routers periodically exchange routing protocol messages which contain routing metrics. Based on these routing metrics, each router computes a forwarding table which contains a valid next hop route for each possible destination address.
160
What are the differences between switches and routers?
Connectivity: Switches - Wired, Routers - Wired/Wireless. Network: Switches - LAN, Routers - LAN/WAN. Host identifier: Switches - MAC address, Routers - IP addresses. TCP/IP layer: Switches - Network layer, Routers - Internet layer.
161
What is the difference between MAC addresses and IP addresses?
A MAC address stays fixed no matter your location on the network. An IP address makes it possible to deliver a packet to a host.
162
What is a Twisted-Pair Cable?
A twisted-pair cable consists of four pairs of copper wires twisted together in a shielded cable. The direction of the interference changes with “each twist”, thereby reducing the interference at one pair from other nearby pairs.
163
What is a Fibre-Optic Cable?
A fibre-optic cable consists of a bundle of light-conducting fibres in a shielded cable.
164
What are the differences between Fibre and Twister-Pair cables.
In comparison to twisted-pair cables, fibre: has a higher bandwidth, maintains its signal strength better over longer distances, is not affected by electromagnetic interference, and has lower security risks. However fibre also: has a higher installation cost and is more brittle.
165
What are Terrestrial Radio Channels?
A terrestrial radio channel links two-or-more mobile stations via a base station. This includes Wi-Fi and cellular communication. It is convenient, but has struggles with path loss, interference, obstructions and low security.
166
What are satellite radio channels?
A satellite radio channel links two-or-more ground stations via a geostationary satellite. It has high geographical availability and quick recovery time post-disaster, but high latency.
167
What protocols are on the application layer?
Examples of application layer protocols are the Hypertext Transfer Protocol (HTTP), File Transfer Protocol (FTP), Simple Mail Transfer Protocol (SMTP), Secure Shell (SSH), and Domain Name System (DNS).
168
What is a client-server protocol?
In a client-server protocol, a client sends a request to a server and receives a response back from it
169
What is a peer-to-peer protocol?
In a peer-to-peer protocol, one peer sends a request to another, and receives a response back from it.
170
How does HTTP work?
In the Hypertext Transfer Protocol (HTTP), a client sends a request for a web page to a server and receives the page as a response back from it. HTTP combines hypertext with methods for sending this hypertext between clients and servers.
171
What does a HTTP request consist of?
The request line, the request headers, and the request body.
172
What does the request line consist of?
A method (such as GET, HEAD, POST, PUT, DELETE), a resource (for example /images/logo.png), and a version (such as HTTP/1.1).
173
What do the request headers consist of?
The request headers consist of (name, value) pairs on separate lines. For example: Content-Length : 324 The most important request headers are: Host (domain name of server), Connection (keep alive/close), Content-Length, Cookie, Date, User-Agent (browser), Accept-Charset (character encodings).
174
What does the request body consist of?
A body which is empty except for POST and PUT requests.
175
What does a HTTP response consist of?
The status line, the response headers, and the response body.
176
What does the status line consist of?
A version, code and reason. For example HTTP/1.1 200 OK Some of the most important codes and reasons are 200: OK; 301: Moved Permanently; 404: Not Found; 500: Internal Server Error.
177
What do the response headers consist of?
A name and a value. The most common names are Cache-Control (caching allowed), Expires, Connection, Content-Type, Content-Length, Server, Set-Cookie (set cookie id).
178
What does the response body consist of?
Contains a body, usually filled with HTML text.
179
How is a web page loaded?
A client examines a received HTML file and looks for references to other files, and then sends HTTP requests for these as well. Files that are found in the web cache do not need to be requested.
180
What does HTTP 2.0 do that 1.1 does not?
In HTTP 2.0, a response or request is subdivided into frames and thereby enables frames from different streams to be interleaved and then reassembled by the receiver.
181
What does HTTPS do?
With HTTPS, all requests and responses are encrypted. Authentication proves that the server is the legitimate host of the website.
182
What is the DNS?
In the Domain Name System (DNS), a client sends a request for the IP address of a specific web address to a server and receives the IP address as a response back from the server.
183
What is a web address?
A web address, also known as a Uniform Resource Locator (URL), consists of three parts: a protocol identifier, a host name, and a subdirectory. for example https:// (protocol) computersceience.exeter.ac.uk (host name) /research/ (subdirectory). Only the host name maps to an IP address.
184
How does the DNS achieve Scalability?
The DNS must be scalable — it must cope with all hosts. The DNS achieves scalability by organizing a large number of servers in a hierarchical fashion. There are thirteen root servers at the top of hierarchy. There are many top-level domains servers for country-based (.cn, .us, .de, .uk, .nl, .ru, ...) and generic (.com, .net, and .org, ...) top-level domains. Top-level domains are managed by ICANN. Web addresses may utilise multiple subdomains separated by periods (pronounced “dot”) in a hierarchical fashion, e.g., computerscience.exeter.ac.uk.
185
How does the DNS achieve efficiency?
DNS must be efficient — it must not delay any host. The DNS achieves efficiency by local server caching. Clients and routers may also use their own DNS caches.
186
How does the DNS achieve reliability?
The DNS must be reliable — there must not be a single point of failure. There are thirteen Root Servers, [A..M], distributed throughout the world.
187
How does the DNS achieve maintainability?
The DNS must be maintainable — it is constantly updated. The IP address associated with a website can change due to changes in the web server, in the network configuration, or in the internet service provider. Authoritative domain servers can be registered, updated and deregistered automatically. These changes then propagate upwards through the tree.
188
How does the Domain Name System Security Extensions (DNSSEC) work?
It uses asymmetric encryption and hash functions. When a DNS server sends a message, it attaches the hash encrypted with its private key, along side the message. The client can decrypt the hash with the public key, and compare it with the hash of the message.
189
What two protocols are provided in the Transport Layer?
The Transmission Control Protocol (TCP) and The User Datagram Protocol (UDP).
190
What are TCP and UDP?
Transport layer protocols that chop up data and apply headers with data such as source and destination ports.
191
What are the source port and destination port in a TCP header?
The source port is the port number of the sender, and the destination port is the port number of the destination. Ports are used to map data to the correct process.
192
What is the sequence number and acknowledgement number in a TCP header.
The sequence number is a number that identifies the current byte of data being sent. The acknowledgement number is a number that is used to acknowledge receipts of data.
193
What is the Window Size, Checksum and Urgent Pointer in a TCP header?
The window size is the number of bytes that the receiver is willing to accept. The checksum is a value used to detect errors in the header and data. The urgent pointer indicates urgent data.
194
What are the seven TCP services?
Connection-oriented communication (An application sets up a connection, uses it, and tears it down) End-to-End communication (A connection has exactly two endpoints) Complete reliability (Data will be received exactly as sent) Full-Duplex communication (Data may be sent and received simultaneously) A Stream Interface (A continuous stream of data is sent and received) Reliable Connection Startup (provided via a 3 way handshake so communication always starts properly) Graceful Connection Shutdown (provided via a 4 way handshake so communication always finishes properly)
195
What are the four parts of a UDP header?
Source Port - Port number of the sender Destination Port - Port number of the destination Length - Total length of the packer Checksum - Detects errors
196
What are the four UDP services?
Connectionless Communication (An application does not set up or tear down a connection) End-to-End Communication (A connection has exactly two endpoints) Best-Effort Reliability (Data may be lost, duplicated, or delayed) A message interface (Individual data items are sent and received)
197
What are the advantages of TCP and UDP?
TCP: Full reliability, but high latency UDP: Minimal latency, but only has best-effort reliability TCP is used when the whole file needs to reach its destination, and UDP when latency is more important.
198
What is IPV4?
The fourth edition of the Internet Protocol, found on the Internet Layer.
199
How is an IPv4 address formatted?
4 bytes data. Uses a dotted decimal notation. This means 10010000 10101101 00000110 10001001 becomes 144.173.6.137. It is divided into a network prefix and host suffix.
200
What is CIDR notation and Subnet masking?
CIDR is a method of writing the IP address and the number of bits in the network prefix. for example 10.1.1.1/8 has 8 bits in the network prefix. CIDR notation is an alternative way of representing a subnet masks. Subnet masks look like IP addresses, but a 1 means prefix, and a 0 means not prefix. For example 255.255.255.252 is a 30 bit network prefix.
201
What is subnetting?
Organizations will use subnetting to divide large networks into smaller, more efficient subnetworks. Part of the host suffix is used to identify individual subnets.
202
What are the four services provided by IPv4?
Addressing - It gives every host and router network interface an address.
203
What are the four services provided by IPv4?
Addressing - It gives every host and router network interface an address. Forwarding - A router forwards packets on the appropriate interface according to their addresses. Routing - This is where the best path for the data to take is determined. A router stores a forwarding table which specifies an interface for each possible destination address. Reporting - The Internet Control Messaging Protocol (ICMP) allows hosts and routers to communicate (often error) information to each other.
204
What is IPv4 Space Exhaustion?
In October 2015, the American Registry for Internet Numbers (ARIN) announced that it had exhausted its pool of addresses; other registries are exhausted too. There are only 2^32 addresses which is 4.2 billion, way less than the global population.
205
What are the two methods of conserving IPv4 addresses?
Network Address Translation - A Network Address Translation (NAT) box maps many “inside” addresses to a single “outside” address, using port numbers to resolve ambiguity. Classless Inter-Domain Routing - Allows for any size of subnet, reducing waste of IP addresses.
206
How does IPv6 provide a larger address space?
IPv6 consists of 128 bits, meaning it allows for 2^128 addresses, which is a massive amount. IPv6 addresses use eight 16 bit words, which can be written as eight groups of four hex symbols.
207
How can IPv6 addresses be abbreviated?
Remove any leading 0s within each group of four hex symbols. One string of one or more groups consisting of all zeros can be replaced with a double colon.
208
How is an IPv6 address structured?
Usually has a 48 bit site prefix and a 16 bit subnet ID, followed by a 64 bit interface ID.
209
What is EUI-64?
EUI-64 allows each host to give themselves a unique interface ID based on its MAC address. This is no longer used because of security issues. Instead we now use random and temporary interface identifiers.
210
How does IPv6 provide built-in security?
Every IPv6 packet has a fixed header, some optional headers, that may be used for security features, and a payload. An optional authentication header has an SPI for encryption, and some authentication data for signing.
211
What does a jumbogram do?
Allows for a larger maximum transmission size, which reduces the communication overhead.
211
What does a jumbogram do?
Allows for a larger maximum transmission size, which reduces the communication overhead.
212
What is CSMA/CD?
Used in wired networks. All computers are attached to a shared cable, and any computer may transmit if the cable is unused. While transmitting, a computer may detect that it is receiving a message, after detecting a collision, a computer waits for a random interval (chosen from an exponentially-doubling range), and then tries again. It is barely used nowadays.
213
What is CSMA/CA?
All computers use a shared frequency, and any computer may transmit if the frequency is clear. A computer finding the frequency clear, transmits after an instant. A computer finding the frequency busy counts down from a random value, and if the channel is clear tries to transmit and hopefully receives an acknowledgement.
214
What is the hidden node problem and how is it solved?
The hidden node problem is when a computer may be in range of the base station, but out of range of another computer. The hidden node problem may be solved by reservation using ready to send and clear to send messages.
215
What is the Token Ring protocol?
In a token ring wired network, a token continuously circulates, to which messages may be attached, and from which they may be removed.
216
What is the Bit-Map protocol?
In a bit-map protocol, host n may announce that it has a frame to send by inserting a 1 bit into slot n. Following this, hosts begin to transmit frames in numerical order.
217
What is the Binary countdown protocol?
Hosts that wish to transmit broadcast their binary address. Hosts with ”1”s in their address get priority. The winner of the bid gets to transmit a frame.
218
What can a firewall do?
- Restrict both incoming and outgoing traffic - Use both positive and negative filters - Consider both the payload and different TCP/IP headers - Consider packets individually or as part of a flow
219
What can a firewall do?
- Restrict both incoming and outgoing traffic - Use both positive and negative filters - Consider both the payload and different TCP/IP headers - Consider packets individually or as part of a flow
220
What is a Packet-Filtering firewall?
A packet-filtering firewall filters individual packets on the basis of packet headers (up to the transport layer) and packet payloads. It may filter based on port numbers, IP addresses, filetypes and malware signatures.
221
What is a wildcard mask?
A wildcard mask indicates which bits of an IP address a particular rule is concerned with during IP address matching. A 0 means the corresponding but must match, and a 1 means it does not matter. This can be used to allow or deny specific IP addresses.
222
What is a stateful firewall?
A stateful firewall reviews the same packet information as a packet filtering firewall, but also filters packets on the basis of a directory of established transport-layer connections. It can track TCP and UDP connections.
223
What is an Application-Level Gateway?
An application-level gateway filters packets based on applications. An application-level gateway sets up two TCP connections: one from the trusted network to the firewall, and one from the firewall to the untrusted network. This can be used to block specific websites.
224
What is a Circuit-Level gateway?
A circuit-level gateway determines which TCP connections will be allowed. Just as the application-level gateway, a circuit-level gateway sets up two TCP connections. The circuit-level gateway approves or denies the TCP connection based on IP addresses, port numbers, user authentication, etc.
225
What is a Single Firewall inline?
A single firewall inline puts a firewall between an external and internal router.
226
What is a Double Firewall inline?
A double firewall inline puts a demilitarized zone (DMZ) between an external and internal firewall. The DMZ is a network for systems that must be externally accessible (e.g., e-mail, DNS, web), but still need some protection.
227
What is a VPN?
A virtual private network (VPN) uses encryption and authentication (provided by, for example, IPsec) to provide a secure connection through an otherwise insecure network, typically the Internet.
228
What are the pros and cons of a VPN?
Pros: A VPN can be used to bypass firewalls and other restrictions, and to increase privacy and security. Cons: Using a VPN may result in a lower connection speed, blocks from certain internet services, and resale of your data to third parties.