part 1 Flashcards

1
Q

What is an operating system?

A

A main program that ALWAYS runs on the processor from system startup, and manages the execution of other programs

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

What are the steps involved in executing a program?

A
  1. When system starts, execute operating system.
  2. Load additional programs into memory.
  3. Request execution of program using a system call.
  4. Operating system starts execution of program.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a system call?

A

A mechanism that allows user-level programs to request services or resources from the operating system’s kernel, such as file operations, memory management, or process control.

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

What are the three elements of a computer system?

A
  1. Users (humans, machines)
  2. Software (application programs, operating system, system programs)
  3. Hardware - CPU, memory, battery, input/output devices
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are application programs?

A

Software designed to perform specific tasks or functions for end-users on a computer system, typically operating on top of the system software in a device
- e.g., word processing, web browsing, data analysis

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

What are system programs?

A

Software that manage and support a computer’s core functions, facilitating communication between hardware and application programs

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

What is the CPU?

A

The central processing unit, the primary component of a computer that performs calculations, executes instructions, and manages data processing tasks to run programs and operations

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

What is a device controller?

A

A hardware component managing the communication between the CPU and external devices (such as storage drives, printers)
- translates data and control signals between them

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

What is an interrupt?

A

A signal sent to the CPU by hardware or software to temporarily halt its current operations and redirect its attention to a higher-priority task or event

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

What is a device controller buffer?

A

A temporary storage area that holds data being transferred between a peripheral device and the system’s memory, helping to manage data flow and prevent bottlenecks during communication

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

Describe as an example the process of a computer accessing data on a hard drive. Why is this example inefficient? How can some of these issues be fixed?

A
  1. CPU tells device controller what data it wants to read (writing command + address in device controller registers)
  2. Device controller accesses the hard drive.
  3. Hard drive recovers data on disk and writes it in the device controller buffer.
  4. Device controller tells the CPU that the data is ready using an interrupt.
  5. CPU reads data in the device controller and copies it in memory.

CPU wastes time waiting for I/O operation to complete. CPU performs many copy operations. CPU must treat many interrupts.

By using direct memory access DMA

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

What is Direct Memory Access (DMA)? Provide an example of accessing data on a hard drive using a DMA.

A

A method that allows peripheral devices to transfer data directly and from the system’s memory without involving the CPU

  1. CPU tells DMA what block of data it wants to read (command + start address + size of block it wants in DMA registers)
  2. DMA configures the I/O device controller for every data that must be read.
  3. Device controller accesses the hard drive.
  4. Hard drive recovers data and writes it in the device controller buffer.
  5. DMA reads data in device controller and copies it in memory.
  6. Once all the data is transferred into memory, DMA tells CPU the I/O transfer is completed using an interrupt.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How does the CPU interface with the device to coordinate the transfer for DMA?

A

CPU initiates a DMA operation by writing values into special registers that can be independently accessed by the device.

Device initiates corresponding operation once it receives the command from the CPU.

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

CPU Is allowed to execute other programs while the DMA controller is transferring data. Does this process interfere with the execution of user programs? If so, how?

A

Both device and CPU can be accessing memory simultaneously. A CPU might therefore have to compete with the device to access the memory, lowering its speed.

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

What are the advantages of DMA? What are some issues regarding to DMA?

A

Less operations executed by CPU. Less interrupts to treat. CPU can execute other useful code in parallel.

Deciding what to execute while waiting for I/O operation. Providing code to configure hardware devices, treat interrupts. Ensuring program state remains consistent through switches.

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

Describe three general methods for passing parameters to the operating systems.

A
  1. Passing parameters in registers.
  2. Registers pass starting addresses of blocks of parameters.
  3. Parameters can be placed, or pushed, onto the stack by the program, and popped off the stack by the OS.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Provide an example of system components that are difficult to layer?

A

The virtual memory subsystem and the storage subsystem are typically tightly coupled and requires careful design in a layered system due to the following interactions. Many systems allow files to be mapped into the virtual memory space of an executing process. On the other hand, the virtual memory subsystem typically uses the storage system to provide the backing store for pages that do not currently reside in memory. Also, updates to the file system are sometimes buffered in physical memory before it is flushed to disk, thereby requiring careful coordination of the usage of memory between the virtual memory subsystem and the file system.

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

What are some of the specific functionalities of the OS as an intermediary between users/applications and computer hardware?

A

Providing a level of abstraction that hides the details of hardware architecture from applications.

Manages sharing of HW resources among applications and users.

Optimises performance through resource management.

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

What would application developers have to know without operating systems? What effects would this have?

A

Hardware platform details to be able to write applications.
Managing memory and address space.
Manage I/O operations.
Manage communications.
Manage file system.

Time consuming, error prone application development. Low portability, as code cannot be easily used on other HW platforms. Hard to use third-party code and libraries.

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

What is a driver?

A

A software development that allows the operating system to communicate with and control hardware devicesm providing a standardised interface for device functionality

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

What are the 8 main responsibilities of an operating system?

A
  1. Process Management:
    - creating and deleting, scheduling, suspending, resuming, synchronising, inter-process communication
  2. Memory Management:
    - allocating, deallocating memory space; efficient utilisation of memory; kepping track of current memory use and by whom
  3. I/O Management:
    - buffer-caching system, general device-driver interface, drivers for specific HW devices
  4. File Management:
    - mainpulating files, directories; maping files onto secondary storage-disks; free space management and storage allocation; disk scheduling
  5. Protection:
    - ensuring that concurrent processes do not interfere with one another
  6. Error Detection:
    - debugging facilities
  7. Security:
    - against other processes, outsiders
  8. Accounting:
    - using timers, CPU Cycles, main memory usage, I/O device usage
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

What is an interrupt service routine?

A

A specialised function or routine in software that is executed in response to an interrupt, handling the interrupt cause and ensuring the CPU can resume its normal operations afterward

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

What is an interrupt vector table?

A

A data structure that holds the addresses of interrupt service routines (ISRs), allowing the CPU to quickly locate and execute the appropriate ISR when an interrupt occurs

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

Describe an example of a HW device instructing the OS to carry out an operation.

A
  1. Interrupt generated to notify the CPU of something.
  2. OS jumps at predefined address memory corresponding to this interrupt.
  3. OS saves current execution context.
  4. OS checks what caused interrupt.
  5. OS retrieves the address of corresponding interrupt service routine from interrupt vector table.
  6. OS executes the interrupt service routine.
  7. OS resumes execution context.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

What are traps/exceptions? For what purposes can they be used?

A

Software-generated interrupts caused by either a software error or by calling a specific assembly function

Calling operating system routines or catching errors

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

What is the trap handler?

A

A routine in the operating system that handles exceptional conditions or events that interrupt the normal execution of a program

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

Describe an example of an application generating a trap and the consequent operations.

A

1.Application generates trap
2. CPU jumps at predefined address in memory corresponding to the trap handler
3. OS saves current execution context
4. OS checks why the trap was generated
5. OS executes the requested service
6. OS resumes the execution context

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

What is the OS Dual-Mode Operation? What is the user-mode? How about the kernel mode? Which operations are executed in which mode?
What is the advantge of this Dual-Mode?

A

A system architecture that allows the CPU to operate in two modes, user and kernel.

Where application run with limited access to system resources.

Where the operating system has full control over hardware and system operations.

Most instructions executed in user mode, but some privileged instructions are only executable in kernel mode, such as accessing memory locations reserved for the OS.

Allows the OS to protect itself and other syste components

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

What is the microkernel approach to system design?

A

Reduces the kernel to only the core functionalities necessary for basic system operation, such as interprocess communication (IPC), basic scheduling, and low-level hardware management

Higher-level services, like file systems, device drivers, and network protocols, are implemented in user space as separate processes, enhancing modularity and fault isolation

30
Q

What are the main advantages of the microkernel approach to system design? How about the primary disadvantages?

A

Advantages:

Adding a new service does not require modifying the kernel

More secure as more operations are done in user mode than kernel mode

Simpler kernel design and functionality typically result in a more reliable OS

Disadvantages:

Overheads associated with interprocess communication (between kernel and user services);

Frequent use of OS’s messaging functions

31
Q

What is the mode bit? How is the mode bit changed?

A

A bit in the CPU’s status register that indicates the current operating mode (user or kernel mode)

A system call changes the execution mode to kernel mode, while returning from the system call resets the mode to user.

32
Q

What are the six main motivations for operating systems?

A
  1. Dealing with diverse CPUs and architectures, organisations.
  2. Transparency, i.e., hiding certain details
    - e.g., location of data in physical memory, physical memory size, processor architecture
  3. Visualisation, i.e., providing a simple, abstract, logical model of system with virtual memory, CPU, disk
    - allows programs to be developed as if they were the sole user of the HW resources
  4. Support for Shared Functionality:
    - well defined abstractions of concepts, providing system calls
  5. Portability:
    - programs written within an OS or API can compile/run on any system supporting that OS/API
    - OS provides a unified machine view, defining a virtual machine
  6. Support for Concurrency:
    - concurrency transparency, where each task essentially has a virtual machine of its own
    - manages and protects tasks from each other
    - ensures efficiency through scheduling
33
Q

What are system calls? How are they usually available?

A

Programming interface to the services provided by the OS, typically written in a high-level language

Through a high-level Application Programming Interface (API)

34
Q

What is an Application Programming Interface?

A

A set of rules and protocols that allow different software applications to communicate with each other and with the operating system

35
Q

What are the five main types of System Calls?

A

Process management, File management, Memory management, Device manamgement, Communications, Miscellaneous

36
Q

What are the three advantages of an API over system calls? What is a disadvantage?

A

works at higher abstraction level, closer to programs’ needs

may combine many system calls to implement higher level tasks

programs using an API can compile/run on any system supporting the API

adds one more layer, with additional overhead

37
Q

What are two different flavours of operating systems?

A

Real-time OS and Embedded OS

38
Q

What is real-time OS?

A

OS designed to process data and respond to inputs within a guaranteed time frame, ensuring that critical tasks are completed within strict timing constraints

known performance, known bounds on maximum latencies of API calls

real-time control, stringent dependability

39
Q

What is embedded OS?

A

specialised OS designed to run on embedded systems - dedicated devices with specific functions, offering optimised performance, low resource usage, and real-time capabilities

small footprint, low system requirements

40
Q

What is a process?

A

A program in execution, with a context of execution, which owns resources, i.e., has memory and can own other resources such as files

41
Q

Can several processes run the same program?

A

Yes

42
Q

Would several processes running the same program have the same contexts of execution?

A

No

43
Q

What is a thread? What is shared among threads? What is not shared among threads?

A

A dispatchable unit of work within a process

Code, data, files

Registers, stack

44
Q

What five things is a process defined by?

A
  1. Program code
  2. Stack - region of memory used to store function calls, local variables, control information
  3. Heap - region of memory used for dynamic memory allocation, where memory is allocated and freed at runtime
  4. Data - global variables whose size are unknown
  5. Current state of execution
45
Q

What are the five process states?

A
  1. New - process being created
  2. Ready - process waiting to be assigned to a CPU
  3. Running - process instructions are being executed
  4. Waiting - process is waiting for some event to occur
  5. Terminated - process has finished executing
46
Q

Where are the local variables of a process stored?

A

in the stack

47
Q

What does a process control block (PCB) do? List the things that the PCB keeps track of.

A

Records information associated with a process’ context of execution

Process state;

Program Counter (location of next instruction to execute);

CPU registers (contents of all process-centric registers);

CPU scheduling information (priorities, scheduling queue pointers);

Memory-mangement Information (memory allocated to the process);

Accounting information - CPU used, clock time elapsed since start, time limits;

I/O status information - I/O devices allocated to process, list of open files

48
Q

What is a context switch?

A

The saving of the state of a process whose execution is to be suspended, and the reloading of this state when the process is to be resumed

49
Q

How are processes created? How are processes generally identified? Can parent processes share their memory or resources with their children processes?

A

Parent processes create children processes, which in turn create other processes, forming a tree of processes.

Through a process identifier (pid)

Yes

50
Q

What are the three resource sharing options, two execution options, and two address space options?

A

Parent and children share all resources. Children share subset of parent’s resources. Parent and child share no resources.

Parent and children execute concurrently. Parent waits until children terminate.

Child is a copy of the parent. Child has a new program loaded into its address space.

51
Q

What is the Portable Operating System Interface (POSIX)? What four things does it provide?

A

set of standards defining a consistent application programming interface (API) for maintaining compatibility between different Unix-like operating systems

  1. Host language, compiler (C)
  2. Programming Interface Definition FIles
  3. Programming Interface Implementation Binary or Code
  4. Run-time System (OS)
52
Q

How can an identicaly copy of a process be created (i.e., a child)? What is the sole thing that varies between the two processes? What is shared between the parent and child?

A

By the parent calling the fork() operation

The return value of the fork() operation: 0 for the child, child-pid for the parent

Address space (variables, memory, file descriptors), program counter (next instruction to execute), process state (open files, signal handlers, etc)

53
Q

What is execlp()?

A

An instruction that overwrites the calling process with its argument (an executable program), meaning that the code following it is never reached

54
Q

What is perror()?

A

A generic error printing routing

55
Q

How are the child and parent independent?

A

Child can execute different code/instructions, close or modify resources independently, terminate independently of parent process

56
Q

What does exit(status) do? How about wait()? What does wait return? How about waitpid()?

A

Terminates the process

Blocks until one of children exit

PID of terminated child

Blocks until a specific child (specified in argument) changes its state

57
Q

What is blocking wait? How can it be done?

A

Parent waits for child to terminate, blocking until child finishes

through wait()

58
Q

What is polling wait? How can it be done?

A

Parent checks periodically if the child has terminated without blocking, allowing it to perform other tasks in between checks

waitpid(child, &status, WNOHANG), which checks if the specified child process has terminated, but does not block

WNOHANG flag makes the call non-blocking, so the parent can perform other activities between checks, such as executing code or handling multiple tasks

59
Q

How can process be terminated?

A

Processes can terminate themselves through exit(), with exit() returning status value from child to parent if parent was waiting.

Alternatively, parent may terminate execution of children processes through abort/kill

60
Q

What is cascading termination?

A

The child being terminated automatically because the parent was.

61
Q

What is a zombie?

A

A child process that has no parent waiting upon its termination, i.e., that invoked wait()

62
Q

What is an orphan?

A

A child process that had its parent terminated without having invoked wait()

63
Q

What are two models for interprocess communication?

A

Message Passing and Shared Memory

64
Q

What is message passing? Are messages blocking or non-blocking? What is rendez-vous communication in the context of message passing? How can asynchronous communication be carried out? What can happen when the buffer is full? What happens if the producer is not blocked and the buffer is full?

A

Producer process sends a message to the kernel, which then forwards the message to the target process

Can be both

Where both the sending and receiving are blocking, and communicating processes synchronise on the transmission

Through the use of a temporary queue or buffer being used to hold items temporarily

The producer may be blocked

Consumers see most recent data, miss old one

65
Q

What is shared memory?

A

Processes share a portion of their address space, so messages can be passed through this shared memory.

66
Q

Similarities between iOS and Android? Differences?

A

Similarities:

Based on existing kernels (Linux, Mac OS X);
Architectures use software stacks;
Provide frameworks for developers

Differences:
iOS closed-source, Android open-source;
iOS developed in Objective-C, Android in Java;
Android uses virtual machine, iOS executes code natively

67
Q

Is the DMA a software or hardware component? Is the DMA part of the operating system? Does the DMA replace I/O controllers?

A

Hardware

No, it is not.

No, it does not.

68
Q

Could a DMA negatively impact the execution time of a program?

A

Yes

69
Q

What mode is a CPU in after an interrupt?

A

Kernel mode

70
Q

Through what mechanism are system calls implemented?

A

Traps

71
Q

Explain the different steps involved in the execution of a system call

A

Process puts the code of the sys call in a register.

It generates a trap that switches the
execution mode from user mode to kernel mode.

The kernel executes the right system call using the
system call code. \

The kernel restores the mode bit so that the execution resumes in user mode.