lecture 1 Flashcards

(67 cards)

1
Q

What is an operating system (OS)?

A

Middleware between user programs and system hardware

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

What are the main components managed by an OS?

A
  • CPU
  • Main memory
  • I/O devices (disk, network card, mouse, keyboard, etc.)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the purpose of an OS in terms of hardware abstraction?

A

The OS abstracts hardware details from the application

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

What does the program counter (PC) represent?

A

Address of the next instruction

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

What are condition codes used for?

A

Store status information about the most recent arithmetic operation, used for conditional branching

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

What is a process in the context of an OS?

A

A running program

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

What does the OS do when a program is run?

A
  • Fetches instruction from memory
  • Loads data into registers
  • Decodes and executes the instruction
  • Stores results to memory
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the role of a device driver?

A

Talks the language of the hardware devices and issues instructions to devices

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

What are the design goals of an operating system?

A
  • Convenience
  • Efficiency of usage
  • Isolation between multiple processes
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What does a process consist of?

A
  • Address Space
  • One or more threads of control
  • Additional system state
  • Open files
  • Open sockets
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the difference between single-threaded and multithreaded processes?

A

Single-threaded has one thread of control, while multithreaded has multiple threads encapsulating concurrency

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

Why have multiple threads per address space?

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

What is the function of the OS in memory management?

A

Manages the memory of the process including code, data, stack, and heap

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

What is the significance of virtual addresses in a process?

A

Each process thinks it has a dedicated memory space starting from 0

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

What does the OS do for memory protection?

A

Isolates processes from each other and itself

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

What is virtualization in the context of an OS?

A

The OS transforms physical resources into a virtual form

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

What are the three easy pieces of an OS?

A
  • Virtualization
  • Concurrency
  • Persistence
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What happens during the execution of a compiled program?

A
  • The program is loaded into memory
  • The OS manages the execution environment
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

What is the purpose of the OS in resource allocation?

A

Manage protection, isolation, and sharing of resources

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

What does the OS provide for running programs?

A

Each running program is provided with its own process

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

What is the role of the OS in process switching?

A

Enables switching between processes efficiently

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

Fill in the blank: The OS provides clean, easy-to-use abstractions of physical resources, creating the illusion of _______.

A

[infinite memory, dedicated machine]

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

What does a virtual machine virtualize?

A

The CPU

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

What is the purpose of the Spin function in the cpu.c example?

A

Repeatedly checks the time and returns once it has run for a second

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
What command is used to compile the cpu.c program?
gcc -o cpu cpu.c -Wall
26
What happens when the cpu program runs without interruption?
It runs forever; only Control-C can halt it
27
How can multiple instances of the cpu program be run simultaneously?
Using '&' to run them in the background
28
What problem does the operating system face when managing multiple processes?
The problem of concurrency
29
In the concurrency example, what does the worker function do?
Increments a shared counter
30
What does the 'volatile' keyword indicate in the concurrency example?
That the variable may be changed by different threads
31
What system calls are used for file operations in the persistence example?
open(), write(), close()
32
What is the role of the file system in an operating system?
Manages the disk and handles file storage
33
What are the two types of memory management mentioned?
Physical memory and virtual memory
34
What does xv6 emulate?
A simple, Unix-like teaching operating system
35
What is the initial setup performed by the boot loader?
Sets up the environment to load the kernel into memory
36
What does process management in xv6 include?
Process creation (fork), execution (exec), and termination (exit)
37
What is the purpose of system calls in xv6?
Provide the interface between user programs and the kernel
38
What mechanism does xv6 use to handle interrupts and traps?
Interrupt descriptor table
39
What is the architecture of Intel x86 processors primarily known for?
Complex instruction set computer (CISC)
40
What significant feature was introduced with the 386 processor?
32-bit architecture and flat addressing
41
What is the significance of the Pentium 4F processor?
First 64-bit Intel processor, referred to as x86-64
42
How does AMD's approach differ from Intel in the processor market?
Historically a little bit slower, a lot cheaper
43
What is the purpose of the xv6 file system?
Supports basic operations such as create, delete, read, write, and close
44
What is the typical instruction flow for incrementing a shared counter in a multi-threaded environment?
Load, increment, store
45
What is the potential issue with incrementing a shared counter in concurrency?
The operations do not execute atomically, leading to concurrency problems
46
What is the command to compile the thread.c program?
gcc -o thread thread.c -Wall -pthread
47
What does the 'loops' variable determine in the concurrency example?
How many times each worker increments the shared counter
48
What are the two main components of an operating system discussed?
Hardware and software for persistent data storage
49
What does the xv6 kernel manage regarding memory?
Allocates and deallocates memory as required
50
What is the function of device drivers in the xv6 kernel?
Enable interaction with hardware devices
51
What does the term 'microarchitecture' refer to?
Implementation of the architecture, such as cache sizes and core frequency
52
What company is historically known to follow just behind Intel in the x86 market?
Advanced Micro Devices (AMD) ## Footnote AMD has been recognized for being a bit slower but a lot cheaper than Intel.
53
What significant product did AMD build to compete with Intel's Pentium 4?
Opteron ## Footnote Opteron was a tough competitor to Intel's Pentium 4.
54
What is the x86-64?
AMD's own extension to 64 bits ## Footnote x86-64 is developed by AMD to extend the capabilities of the x86 architecture.
55
What command is used to compile a program for IA32 architecture?
gcc –m32 hello.c ## Footnote This command specifies compilation for the 32-bit IA32 architecture.
56
What command is used to compile a program for x86-64 architecture?
gcc –m64 hello.c ## Footnote This command specifies compilation for the 64-bit x86-64 architecture.
57
List the general-purpose integer registers in IA32 architecture.
* %eax * %ebx * %ecx * %edx * %esi * %edi * %esp * %ebp ## Footnote These registers are used for various general-purpose operations in IA32.
58
What are the 16-bit virtual registers in IA32 architecture?
* %ax * %bx * %cx * %dx * %si * %di * %sp * %bp ## Footnote These registers maintain backwards compatibility in the x86 architecture.
59
What is the purpose of %ebp and %rbp in x86-64 architecture?
They are made general-purpose ## Footnote This change allows for more flexibility in programming.
60
What is the syntax for moving data in Intel syntax?
mov Dst, Src ## Footnote Intel syntax typically does not use size suffixes for mov instructions.
61
What suffix is used in AT&T syntax to indicate a long word (4 bytes)?
l ## Footnote In AT&T syntax, the suffix 'l' specifies the operation size as long (4 bytes on 32-bit, 8 bytes on some 64-bit contexts).
62
Fill in the blank: In IA32, immediate operands are prefixed with _______.
$ ## Footnote Immediate operands are constants prefixed with a dollar sign.
63
What is a limitation of the movl instruction regarding memory transfers?
Cannot do memory-memory transfer with a single instruction ## Footnote The movl instruction cannot directly transfer data between two memory locations.
64
What does the instruction movl (%ecx), %eax do?
Dereferences the pointer in %ecx and moves the value into %eax ## Footnote This is an example of simple memory addressing modes.
65
What is the purpose of the instruction pushl %ebp in the generated IA32 assembly?
Save old base pointer ## Footnote This instruction is used to preserve the previous base pointer before setting up a new stack frame.
66
What does the command gcc -S code.c -o code.s do?
Produces file code.s ## Footnote This command generates the assembly code from the C source code.
67
What does the instruction addl 12(%ebp), %eax do?
Adds the value at the address 12 bytes above %ebp to %eax ## Footnote This instruction is used in the assembly code for adding two integers.