computer-systems-flashcards

(75 cards)

1
Q

Operating System

A

An operating system provides an interface between user applications and hardware, allowing applications to request system-level services. It is responsible for managing computer resources such as the CPU, memory, and I/O devices. The OS supports multiprogramming, security through isolation, and enables running more processes with large memory. It switches to kernel mode to execute privileged instructions when a user application requests services via system calls.

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

Process

A

“A process is an executing instance of a program, including its code, data, and allocated resources. Key characteristics of a process include having its own address space (its own memory), maintaining a program counter (indicating the next instruction), and having an execution state (e.g., running, ready, blocked). Processes are isolated from each other for security.”

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

Process Components

A

The components of a process include the Code (text segment), which contains the program’s instructions and is typically read-only and shareable among instances of the same program. The Data segment holds global and static variables. The Stack segment is used for function calls, local variables, and return addresses, growing and shrinking during execution. The Heap segment is used for dynamic memory allocation.

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

Process States

A

The different states a process can be in are: New (process is being created), Ready (process is waiting for CPU time), Running (process is executing instructions), Blocked (Waiting) (process is waiting for an I/O operation to complete), and Terminated (process has finished execution or been forcibly stopped).

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

System Calls

A

System calls provide an interface between user programs and the operating system, allowing applications to request system-level services. They are necessary because user applications cannot directly access hardware for security and stability reasons.

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

System Calls for Process Management

A

These system calls manage the creation, execution, and termination of processes. Examples include Fork() (creates a new child process), Exec() (replaces a process’s memory with a new program), Wait() (makes a process wait for its child process to finish), Exit() (terminates a process), Getpid() (retrieves the process ID), and Kill() (sends a signal to control or terminate a process).

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

Process Control Block (PCB)

A

The Process Control Block is a data structure used by the operating system to store information about a process. Examples of data stored in the PCB include the process ID, process state, parent process, memory management information, file descriptors, priority, and used CPU time.

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

Process Table

A

The process table is a list containing the Process Control Blocks (PCBs), with one PCB for each process.

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

Threads

A

Threads provide an execution context to a process, enabling the sequential execution of a set of instructions within that process. A thread has its own program counter, stack pointer, registers, and stack. Threads allow multiple tasks within a single process to run concurrently. Thread creation is significantly faster than process creation (10-100 times faster), and threads efficiently share memory and open files within a process.

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

Thread Control Block (TCB)

A

The Thread Control Block stores the context data for a thread, similar to how the PCB stores context data for a process. Examples of data stored in a TCB include the thread ID, stack pointer, program counter, register values, state (e.g., running, blocked, ready), and a pointer to the PCB of the process the thread belongs to.

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

PThreads

A

PThreads is a POSIX standard API for creating and synchronizing threads. Most UNIX systems support it, and functions in this API typically start with pthread.

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

CPU Scheduling

A

CPU scheduling is the process of determining which process or thread among those that are ready gets to run next on the CPU, especially in multiprogramming environments where only one can run at a time on a single-core CPU. A scheduling algorithm determines this choice.

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

CPU-bound process

A

CPU-bound processes have long CPU bursts and spend the majority of their time performing computations.

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

I/O-bound process

A

I/O-bound processes have short CPU bursts and spend most of their time waiting for I/O operations to complete.

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

Batch Systems Scheduling Goals

A

The primary goals of scheduling in batch systems, which run large jobs without much user interaction, are usually to maximize throughput (complete as many jobs as possible) and minimize turnaround time (reduce the total time from submission to completion).

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

Interactive Systems Scheduling Goal

A

In interactive systems, the main goal of scheduling is to minimize response time, which is the time between a user issuing a command and getting a result.

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

Non-pre-emptive scheduling

A

In non-pre-emptive scheduling algorithms, once a process is scheduled to run, it continues executing until it finishes or blocks (e.g., waiting for I/O).

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

First Come First Served (FCFS)

A

First Come, First Served (FCFS) is a non-pre-emptive scheduling algorithm that runs processes in the order in which they become ready to execute. It is simple to implement. A disadvantage is the convoy effect, where short processes can be delayed by a long CPU-bound process ahead of them in the queue, potentially reducing resource utilization. Starvation can occur if a ready process is entirely CPU-bound.

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

Shortest Job First (SJF)

A

Shortest Job First (SJF) is a non-pre-emptive scheduling algorithm that selects the job with the least amount of work to do (shortest CPU burst) until its next I/O request or completion.

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

Round Robin (RR)

A

Round Robin (RR) is a pre-emptive scheduling algorithm where each process is given a fixed time quantum to run. If a process is still running when its quantum expires, it is pre-empted and moved to the back of the ready queue. With a reasonable quantum, it is generally good for response time but not necessarily for turnaround time. It can favor CPU-bound processes over I/O-bound ones. There is overhead associated with context switching between processes. Starvation is not possible in Round Robin.

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

Priority Scheduling

A

Priority scheduling assigns a priority to each job and allocates the CPU to the highest-priority process that is ready to run. If there are multiple processes with the same highest priority, another scheduling algorithm (like FCFS or RR) might be used among them. A potential issue is starvation for lower-priority processes if high-priority processes constantly enter the system.

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

Memory Management

A

Memory management is concerned with managing the computer’s memory. Its purposes include supporting multiprogramming (loading multiple processes into memory for better CPU utilization), providing security through isolation between processes and the OS, and enabling the system to run more processes, even those requiring large amounts of memory.

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

Memory Hierarchy

A

Memory in a computer system is structured in a hierarchy based on speed and size, with faster but smaller memory at the top and slower but larger memory at the bottom. The hierarchy, from fastest to slowest, is: Registers (built into CPU, extremely fast, very small), Cache Memory (L1, L2, L3) (fast memory close to CPU, temporarily stores frequently used data), RAM (Random Access Memory) (main memory, holds active programs and data), Disk Storage (SSD/HDD) (long-term storage, slower), and Virtual Memory (swap space on disk) (extends RAM using disk, much slower due to disk access).

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

Virtual Memory

A

Virtual memory is an operating system technique that extends the available RAM by using disk space (swap memory). It provides a logical address space to each process, which is mapped to physical addresses by the OS using page tables. This abstraction allows each process to believe it has access to the entire memory space, while the OS ensures fair allocation. It prevents programs from exceeding physical memory limits and facilitates multitasking.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Paging
Paging is a memory management technique where memory is divided into fixed-size units called pages (for logical memory) and frames (for physical memory). Pages are loaded into RAM frames as needed. Pages and frames are typically the same size, and pages do not need to be stored in contiguous frames in physical memory.
26
Logical Address
A logical address is an address generated by the CPU. In a paged system, it is typically divided into two parts: the virtual page number and the offset within that page.
27
Physical Address
A physical address is the actual address in the computer's physical memory. The Memory Management Unit (MMU) translates logical addresses into physical addresses.
28
Page Table
A page table is a data structure maintained by the operating system for each process that maps virtual page numbers to physical page frame numbers. The virtual page number from a logical address is used as an index into the page table. The page table is stored in memory, and the Page Table Base Register (PTBR) in the PCB points to its start.
29
Page Table Entry (PTE)
An entry in a page table (Page Table Entry) contains information about a corresponding virtual page. The most important field is the page frame number, indicating where the virtual page is located in physical memory. PTEs also contain status bits such as the present/absent bit, modified (dirty) bit, and referenced bit.
30
Present/absent bit
The present/absent bit in a Page Table Entry indicates whether the page is currently located in physical memory (bit is 1) or on disk (bit is 0). If the bit is 0 and the page is accessed, it triggers a page fault.
31
Modified (dirty) bit
The modified bit in a Page Table Entry is set to 1 when the corresponding page in memory has been written to (modified). This indicates that the page needs to be written back to disk if it is evicted.
32
Referenced bit (R bit)
The referenced bit associated with each page is set whenever the page is accessed (read or written). The operating system periodically clears this bit (e.g., on each clock interrupt) to distinguish pages that have been used recently from those that haven't.
33
Page Fault
A page fault is an event that occurs when a process attempts to access a memory location within a page that is not currently loaded into physical memory. This is indicated by the present/absent bit for that page in the page table being 0. When a page fault occurs, the operating system typically loads the required page from disk into a free frame in physical memory.
34
Internal Fragmentation
Internal fragmentation is the wasted space that occurs within the last page of a process when the process size is not an exact multiple of the page size. The unused space within that last page is internal fragmentation. Larger page sizes generally result in more internal fragmentation.
35
Translation Lookaside Buffer (TLB)
The Translation Lookaside Buffer (TLB) is a fixed-capacity hardware cache located in the Memory Management Unit (MMU). It stores copies of recently accessed page table entries to speed up the translation of logical addresses to physical addresses, avoiding the need to access the page table in main memory on every memory reference.
36
Page Replacement Algorithm
A page replacement algorithm is used by the operating system to decide which page in physical memory should be evicted (moved to disk) when a new page needs to be loaded and all available frames are occupied. The goal is typically to evict a page that is least likely to be needed again soon.
37
First In First Out (FIFO) Page Replacement
The First In First Out (FIFO) page replacement algorithm evicts the page that has been in memory for the longest time. It is simple to implement but may evict frequently used pages.
38
Least Recently Used (LRU) Page Replacement
The Least Recently Used (LRU) page replacement algorithm evicts the page that has not been used for the longest period of time. It attempts to follow the principle of temporal locality. While theoretically realizable, a true LRU implementation can have high performance overhead.
39
Aging Page Replacement
Aging is a page replacement algorithm that approximates LRU. It maintains a bit counter for each page. Periodically, the OS shifts the bits in each counter to the right and appends the referenced bit (1 if referenced since the last check, 0 otherwise) to the leftmost position. At a page fault, the page with the lowest counter value is evicted.
40
Swapping
Swapping is a memory management technique used to handle situations where the total memory required by active processes exceeds the physical RAM capacity. It involves moving entire processes between main memory and secondary storage (disk). Idle processes are typically stored on disk.
41
Interprocess Communication (IPC)
Interprocess Communication (IPC) refers to the mechanisms that allow processes to communicate with each other and share resources or data. Examples of IPC mechanisms include shared memory, pipes, files, sockets, signals.
42
Race Conditions
Race conditions occur in cooperating processes or threads when the final outcome of the execution depends on the specific timing or order in which different processes or threads access and modify shared resources.
43
Mutex (Mutual Exclusion Lock)
A mutex is a synchronization primitive used to prevent race conditions by ensuring that only one process or thread can access a shared resource or critical section of code at any given time.
44
Secure Communication Properties
Desirable properties of secure communication include Confidentiality (only the sender and intended receiver can understand the message content, typically achieved through encryption), Integrity (the ability to detect if the communication content has been tampered with), and Authentication (establishing the identities of the communicating endpoints).
45
Encryption
Encryption is a process used to provide confidentiality by transforming a readable message (plaintext) into an unintelligible form (ciphertext) using an encryption algorithm and a secret key. Only parties with the appropriate decryption key can transform the ciphertext back into plaintext.
46
Symmetric Key Cryptography
Symmetric key cryptography is a type of encryption where the sender and receiver use the identical secret key for both encryption and decryption. It is generally efficient for encrypting large messages but requires a secure method for exchanging the secret key between the parties.
47
Asymmetric Key Cryptography (Public Key Encryption)
Asymmetric key cryptography, also known as public key encryption, uses a pair of mathematically related keys for each participant: a public key (which can be shared widely) and a private key (which must be kept secret). Encryption is typically done using the recipient's public key, and decryption is done using the recipient's private key. This approach does not require secure pre-exchange of a secret key but is computationally more expensive than symmetric encryption for large messages.
48
Hybrid Encryption
Hybrid encryption combines symmetric and asymmetric encryption to achieve efficient confidentiality for large messages. Asymmetric encryption is used to securely exchange a temporary, shared secret symmetric key, and then this symmetric key is used to encrypt and decrypt the actual communication messages.
49
Digital Signature
A digital signature is used to provide authentication (verify the sender's identity) and integrity (detect message modification). The sender creates a signature for the message using their private key, and the receiver verifies the signature using the sender's public verification key.
50
Certificates (Digital Certificates)
Digital certificates are used to securely associate identities with cryptographic public keys. A certificate is typically issued by a trusted Certificate Authority (CA) and contains the identity of a principal (e.g., a person or organization) and their public key, bound together by the CA's digital signature. Certificates are used in authentication protocols to verify the identity of a party.
51
TLS (Transport Layer Security)
TLS is a protocol that runs over the transport layer (typically TCP) to provide secure communication between two endpoints. It has two main parts: the Handshake Protocol, which uses public-key cryptography to establish shared secret keys and negotiate parameters, and the Record Protocol, which uses these shared keys to protect the confidentiality, integrity, and authenticity of the data exchanged. HTTPS is HTTP running over TLS, typically using port 443. With HTTPS, everything is encrypted, including URLs.
52
TLS Handshake Protocol
The TLS Handshake Protocol is an initial negotiation between a client and a server that establishes shared secret keys and other parameters for secure communication. Steps include the client and server exchanging hello messages to propose and select a protocol version and cipher suite, the server sending its certificate, a key exchange process (which uses asymmetric encryption or a method like Diffie-Helman), and finished messages to signal completion. Server authentication using certificates often occurs during the handshake.
53
Cipher Suite (TLS)
A cipher suite in TLS is a set of cryptographic algorithms negotiated between the client and server during the handshake. It specifies the algorithms to be used for key exchange, encryption, and message authentication.
54
OSI Model
"The Open Systems Interconnection (OSI) model is a conceptual, layered reference model for network communication, consisting of seven layers: Physical (Layer 1), Data Link (Layer 2), Network (Layer 3), Transport (Layer 4), Session (Layer 5), Presentation (Layer 6), and Application (Layer 7). It is useful for designing network architectures and diagnosing faults, representing different levels of abstraction."
55
TCP/IP Model
The TCP/IP model is a layered model that reflects the protocols used on the internet. It typically consists of fewer layers than the OSI model, often grouped into Link (or Network Interface), Internet, Transport, and Application layers.
56
Transport Layer (OSI Layer 4)
The Transport layer is responsible for providing services to the application layer, using the services provided by the network layer below it. Transport layer services include multiplexing and demultiplexing (using port numbers), providing a logical communication channel between processes on different hosts, and potentially offering reliable, connection-oriented services (like TCP) or unreliable, connectionless services (like UDP) on top of an unreliable network layer. The data unit at this layer is typically called a segment.
57
Network Layer (OSI Layer 3)
The Network layer is responsible for getting packets from a source host to a destination host across a network. The data unit at this layer is typically called a packet.
58
Data Link Layer (OSI Layer 2)
The Data Link layer is responsible for transferring data between adjacent network nodes on the same link. The data unit at this layer is typically called a frame.
59
Physical Layer (OSI Layer 1)
The Physical layer is concerned with the physical transmission of raw data bits or symbols over the network medium.
60
Socket
A socket serves as an endpoint for communication between processes. It is how user-space code in an application sends messages to and receives messages from the kernel-space networking code. A process uses a socket as its doorway for sending and receiving data.
61
Socket Address
The address of a socket is typically defined by a 5-tuple consisting of the Protocol, Local IP address, Local Port number, Remote IP address, and Remote Port number.
62
Berkeley Sockets API
The Berkeley Sockets API is a standard application programming interface (API) for network socket programming, providing a set of system calls that allow applications to create and manage communication endpoints. This API is widely adopted and supported by most major operating systems, contributing to portability. Examples of socket primitives include socket(), bind(), listen(), accept(), connect(), send(), read(), write(), and close().
63
Connection Socket
A connection socket (also referred to by functions like listenfd in code examples) is used on the server side to announce willingness to accept incoming connections (listen()) and then accept a connection request from a client (accept()).
64
Stream Socket
Stream sockets provide the send and receive functions (send(), write(), read()) that allow peers to exchange data over an established connection. They can be created on the server side by accepting a connection (accept()) or on the client side by actively establishing a connection (connect()).
65
TCP (Transmission Control Protocol)
TCP is a reliable, connection-oriented transport layer protocol. It provides a reliable byte stream service to applications, handling issues like packet loss, out-of-order arrival, and duplicates. TCP uses a sliding window mechanism for flow control (preventing the sender from overwhelming the receiver), reliable delivery, and in-order delivery of data.
66
UDP (User Datagram Protocol)
UDP is a simple, connectionless transport layer protocol. It allows applications to send datagrams over IP without establishing a connection first. UDP provides multiplexing/demultiplexing using port numbers but does not offer reliability features like flow control, error control, or retransmission of lost or bad segments. It is suitable for applications that need precise control over packet delivery or real-time services like voice or video where timely delivery is more critical than reliability.
67
Port Numbers
Port numbers are used by the transport layer for multiplexing and demultiplexing, allowing the operating system to deliver incoming segments to the correct application process on a host. Port numbers are 16 bits, ranging from 0 to 65535. They are classified into well-known ports (0-1023, e.g., 80 for HTTP, 443 for HTTPS, 25 for SMTP), registered ports (1024-49151), and dynamic/private ports (49152-65535).
68
Multiplexing/Demultiplexing (MUX/DEMUX)
Multiplexing (MUX) at the transport layer involves collecting data from different application processes on a host and encapsulating it into segments, which are then passed down to the network layer. Demultiplexing (DEMUX) at the receiving host involves the transport layer delivering incoming segments to the appropriate application process based on information in the segment header, such as port numbers.
69
Application Layer
The Application layer is the highest layer in both the OSI and TCP/IP models. It provides network services directly to end-user applications. Examples of application layer protocols include DNS, email protocols (SMTP, IMAP, POP), and HTTP.
70
DNS (Domain Name Service)
DNS is an application layer protocol that maps human-readable domain names (like facebook.com) to computer-friendly IP addresses (like 128.250.81.2). It uses a hierarchical structure of name servers to store this mapping information in Resource Records (RRs).
71
Resource Record (RR)
Resource Records are entries stored in DNS name servers that contain information about domain names. Different types of RRs exist, such as A (maps hostname to IPv4 address), AAAA (maps hostname to IPv6 address), MX (identifies mail servers), NS (identifies name servers for a domain), and CNAME (creates an alias for a canonical name).
72
SMTP (Simple Mail Transfer Protocol)
SMTP is the main application layer protocol used for transferring email messages between mail servers. It uses TCP (typically on port 25) to provide reliable message transfer. SMTP is a push-based protocol for message delivery.
73
POP3 (Post Office Protocol version 3)
POP3 is an application layer protocol used by email clients to retrieve email messages from a mail server. It is a pull-based protocol. POP3 typically downloads messages from the server to the client and may delete them from the server.
74
IMAP (Internet Mail Access Protocol)
IMAP is an application layer protocol used by email clients to access and manage email messages stored on a mail server. It provides more features than POP3, allowing users to manipulate messages and mailbox folders on the server and keeping user state across sessions. Like POP3, it is a pull-based protocol.
75
HTTP (Hypertext Transfer Protocol)
HTTP is the primary application layer protocol used for the World Wide Web. It is a request-response protocol where a web browser (client) initiates a TCP connection to a web server (server) and sends HTTP request messages. The server responds with HTTP response messages containing the requested web content. HTTP uses methods like GET, POST, PUT, and DELETE and response codes indicating the status of the request (e.g., 200 for success, 404 for page not found).