Operating Systems Concepts
48 Questions
0 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

Which of the following actions is performed by the CPU during the fetch stage of the basic instruction cycle?

  • Writing data to memory.
  • Incrementing the program counter (PC).
  • Executing the instruction.
  • Retrieving the instruction pointed to by the program counter (PC). (correct)

Which of the following is a characteristic of kernel mode?

  • It can execute only a subset of user instructions.
  • It has access to special instructions and registers that control I/O. (correct)
  • It restricts access to I/O and memory control registers.
  • It is typically used for running user applications.

What is the primary function of an interrupt vector?

  • To directly execute interrupt service routines.
  • To link hardware interrupts to interrupt service routines. (correct)
  • To manage the allocation of memory to different processes.
  • To store user data during program execution.

In the context of the diagram, what mechanism enables a process in User Space (P2) to interact with a hardware component managed in Kernel Space?

<p>An interrupt or trap. (A)</p> Signup and view all the answers

Referring to the example machine code, what operation does the instruction 0x21A2 most likely perform?

<p>Store the value in register <code>R1</code> to memory address <code>0xA2</code>. (B)</p> Signup and view all the answers

If a program is running in user mode and requires access to a hardware resource like a disk, what mechanism must it employ to request this service?

<p>Triggering a system call that transitions the CPU to kernel mode. (C)</p> Signup and view all the answers

In the given machine code example, what is the virtual address of the instruction decr R2?

<p><code>0x18</code> (A)</p> Signup and view all the answers

Consider a scenario where a program in user mode attempts to execute an I/O instruction directly. What is the most likely outcome?

<p>A hardware trap or fault occurs, causing the operating system to take control. (B)</p> Signup and view all the answers

In the provided examples of co-operating sequential processes, what is the primary purpose of using semaphores?

<p>To ensure that shared resources are accessed in a mutually exclusive manner, preventing race conditions. (B)</p> Signup and view all the answers

What happens after a signal handler (a function) completes its execution?

<p>The program resumes execution from where it was interrupted. (C)</p> Signup and view all the answers

Which of the following accurately describes the nature of signals in the context of operating systems?

<p>Signals are integer-valued actions, similar to hardware interrupts. (B)</p> Signup and view all the answers

In the provided signal example, what is the purpose of the signal function?

<p>To associate a signal with a specific signal handler function. (C)</p> Signup and view all the answers

When a process receives the SIGINT signal, as demonstrated in the example, what is the immediate action taken by the signal handler?

<p>The signal handler prints an error message and then performs cleanup operations before exiting. (B)</p> Signup and view all the answers

How does data within a pipe get stored?

<p>Within a buffer existing only in the memory. (A)</p> Signup and view all the answers

Consider a scenario where a process is waiting for I/O. According to the basic process scheduler loop, what is the immediate action taken by the scheduler?

<p>The process is marked as blocked along with the reason and its context is saved. (D)</p> Signup and view all the answers

In the context of process scheduling, what is the primary role of 'saving process context'?

<p>Storing the current state of the process so it can resume later. (C)</p> Signup and view all the answers

Which scheduling algorithm prioritizes processes based on their estimated execution time?

<p>Shortest Job First (SJF) (D)</p> Signup and view all the answers

In a circular queue implementation within a device driver, what is the primary purpose of the modulo operator (%) when updating endQpos or startQpos?

<p>To ensure that the position values remain within the bounds of the queue's allocated memory. (C)</p> Signup and view all the answers

What is the purpose of the splx(s) function in the device driver code snippets?

<p>It restores the interrupt mask to its previous state, enabling interrupts. (B)</p> Signup and view all the answers

In the context of device drivers, what potential issue does using spltty() and splx() functions aim to prevent?

<p>Race conditions due to interrupt handlers accessing shared resources. (D)</p> Signup and view all the answers

The tsleep function is used for what purpose in the devread function?

<p>To block the current thread until data is available in the queue. (C)</p> Signup and view all the answers

What happens in the devintr() function if QSIZE == numQ?

<p>The function returns immediately without adding the new character to the queue. (C)</p> Signup and view all the answers

What is the role of the wakeup(devread) function call in the devintr() function?

<p>It unblocks any threads that are sleeping in the <code>devread</code> function, indicating that data is available. (D)</p> Signup and view all the answers

Why is it necessary to call spltty() before checking QSIZE == numQ in the devintr() function and then splx(s) before returning?

<p>To prevent the queue size from being modified by another process before the check is complete. (D)</p> Signup and view all the answers

The text mentions that the operating system provides a 'simplified pseudo-computer' environment for program execution. What does this abstraction primarily aim to achieve?

<p>To isolate programs from the complexities of the underlying hardware and other running programs. (D)</p> Signup and view all the answers

In the context of concurrent processes, what is the primary purpose of using synchronization primitives like mutexes and semaphores?

<p>To ensure only one process or a limited number of processes can access a shared resource at a time. (C)</p> Signup and view all the answers

Consider a producer-consumer scenario using a queue. If numQ represents the current number of items in the queue and QSIZE represents the maximum queue size, what condition should a producer process wait for before adding an item to the queue, using the provided mutex synchronization?

<p>Wait until <code>numQ</code> is less than <code>QSIZE</code>. (C)</p> Signup and view all the answers

In the provided consumer code snippet, what condition causes the consumer process to wait before deleting an item from the queue?

<p>Waiting until <code>oldsize</code> is equal to 0. (D)</p> Signup and view all the answers

In the hardware-level mutual exclusion implementation, what is the purpose of the TEST_AND_SET operation?

<p>To atomically set <code>mutexFlag</code> to 1 and retrieve its previous value. (A)</p> Signup and view all the answers

In Dekker's algorithm, what is the purpose of the need array?

<p>To indicate whether a process intends to enter the critical section. (A)</p> Signup and view all the answers

In Dekker's algorithm, the turn variable plays a crucial role in resolving contention. What does the assignment turn = !who; signify?

<p>It indicates that the other process should enter the critical section if it needs to. (A)</p> Signup and view all the answers

Consider the ps auxw output provided. What does the 'S' state indicate in the output for most of the listed processes?

<p>The process is sleeping. (C)</p> Signup and view all the answers

Referring to the ps auxw output, which command is the process with PID 1921 running?

<p><code>/sbin/mingetty t</code> (D)</p> Signup and view all the answers

How is the physical address calculated from a virtual address, given a frame number, page size, and offset?

<p>PhysicalAddress = (FrameNumber × PageSize) + Offset (A)</p> Signup and view all the answers

Which of the following best describes the role of the Memory Management Unit (MMU) in address translation?

<p>It converts virtual addresses to physical addresses. (D)</p> Signup and view all the answers

What does the 'Valid' bit in a page table entry indicate?

<p>Whether the page is currently residing in physical memory. (D)</p> Signup and view all the answers

In the context of memory management, what is the purpose of the 'Dirty' bit?

<p>Indicates the page has been modified and needs to be written back to disk. (A)</p> Signup and view all the answers

Given a virtual address 0x072E for process 1 and a page size of 0x200 (512 in decimal), what is the page number?

<p>0x3 (B)</p> Signup and view all the answers

Continuing from the previous question, if page 0x3 maps to frame 0xD, what is the physical address?

<p>0x1B2E (D)</p> Signup and view all the answers

If a system uses 11 bits for the page offset, what is the page size in bytes?

<p>2048 (C)</p> Signup and view all the answers

Given a virtual address 0x77FF and a page size of 0x800, what is the offset?

<p>0x7FF (D)</p> Signup and view all the answers

If page 0xE maps to frame 0x11, and the page offset is 0x7FF, what is the resulting physical address?

<p>0x8FFF (C)</p> Signup and view all the answers

In the context of the examples, what event occurs when the MMU attempts to translate a virtual address and finds the 'Valid' bit is not set?

<p>A page fault occurs, triggering the OS to load the required page from disk. (D)</p> Signup and view all the answers

When a page fault occurs, what is the typical sequence of actions taken by the operating system?

<p>Updates the page table, retrieves the page from disk, and restarts the MMU access. (A)</p> Signup and view all the answers

What is the significance of the Read-Only (RO) attribute in a page table entry?

<p>It allows the page to be read but not modified, protecting code or constant data. (C)</p> Signup and view all the answers

Considering the address translation process, which of the following components determines whether a virtual address belongs to a valid region of memory for a process?

<p>The MMU, in conjunction with the page table and valid bit. (D)</p> Signup and view all the answers

What is the role of the Disk Address field in the page table?

<p>It indicates the location on the disk where the page is stored when it is not in physical memory. (C)</p> Signup and view all the answers

How does increasing the page size affect the internal fragmentation and the size of the page table?

<p>Increases internal fragmentation and decreases the page table size. (B)</p> Signup and view all the answers

Flashcards

ALU basic instruction cycle steps

Fetch, increment PC, execute.

User mode

Can execute most, but no I/O.

Kernel mode

Execute all, PLUS I/O control.

Interrupt vector

Links hardware interrupts with interrupt service routines.

Signup and view all the flashcards

Interrupt or trap

Communication path between processes.

Signup and view all the flashcards

load R1, 0xA2

Code: 0x11A2, Addr: 0x10. Instruction to load value at 0xA2 into R1.

Signup and view all the flashcards

incr R1

Code: 0x3100, Addr: 0x12. Instruction incrementing value in R1.

Signup and view all the flashcards

store R1, 0xA2

Code: 0x21A2, Addr: 0x14. Instruction storing value to Memory location 0xA2.

Signup and view all the flashcards

Semaphore

A synchronization primitive that controls access to a shared resource, preventing race conditions. Initial value determines initial access.

Signup and view all the flashcards

SEM_WAIT

A process waits (decrements) until a semaphore's value is positive, then proceeds. If zero, the process blocks.

Signup and view all the flashcards

SEM_SIGNAL

A process signals (increments) when it releases the resource, potentially waking a waiting process.

Signup and view all the flashcards

Cooperating Processes

Two processes ('up' and 'down') use semaphores to coordinate access to a shared variable, modifying and printing it.

Signup and view all the flashcards

Semaphore Initialization

The initial values of semaphores 'U' and 'D' determine which process goes first and how control is handed off.

Signup and view all the flashcards

Circular Queue (Ring Buffer)

A data structure that uses a fixed-size buffer as if it were connected end-to-end. Items are added to the end and removed from the start, with the indices wrapping around.

Signup and view all the flashcards

numQ

The number of items in the queue

Signup and view all the flashcards

startQpos

The index position of the first element in the queue.

Signup and view all the flashcards

endQpos

The index position where the next element will be added into the queue.

Signup and view all the flashcards

Critical Sections

Sections of code that must be protected from concurrent access to prevent race conditions, often by disabling interrupts.

Signup and view all the flashcards

spltty() and splx()

Masks interrupts to prevent concurrent access, returning previous state. Used to protect critical sections.

Signup and view all the flashcards

tsleep()

Putting a process to sleep, blocking it until a specific event occurs (wakeup).

Signup and view all the flashcards

wakeup()

Unblocks all threads that are asleep and have the given identifier.

Signup and view all the flashcards

Mutex

A synchronization primitive that allows only one process to access a critical section at a time.

Signup and view all the flashcards

Producer's while condition in add_queue

Waits until the number of items in a queue is not equal to its maximum size before proceeding.

Signup and view all the flashcards

Consumer's while condition in del_queue

Waits until there is at least one item in a queue before proceeding.

Signup and view all the flashcards

TEST_AND_SET

A hardware mechanism that atomically sets a flag to 1 and returns the old value.

Signup and view all the flashcards

critical_begin() implementation

A function that implements mutual exclusion by using TEST_AND_SET to acquire a lock.

Signup and view all the flashcards

Dekker's Algorithm key ideas

Flags its intention, gives the other process a chance, and loops if the other process is also interested and it's not its turn.

Signup and view all the flashcards

Signal

A software interrupt. When a signal is received, the process pauses its current execution to call a designated signal handler function.

Signup and view all the flashcards

Signal Handler

A function that is executed when a specific signal is received by a process. After the handler is finished, control returns to where the process left off.

Signup and view all the flashcards

Common Signals

HUP: Hangup, INT: Interrupt, QUIT: Quit, ILL: Illegal instruction, TRAP: Trace trap, KILL: Kill process, BUS: Bus error, SEGV: Segmentation violation, PWR: Power failure, TERM: Terminate process, USR1: User defined #1, USR2: User defined #2.

Signup and view all the flashcards

Pipe

A pair of file descriptors that connect two processes. Data written to one end can be read from the other, enabling one-way communication.

Signup and view all the flashcards

Pipe Buffer

A shared memory buffer between two processes, facilitating data transfer. It is stored only in memory, without residing in the filesystem.

Signup and view all the flashcards

Basic Scheduler Loop

Mark process as RUNNABLE or blocked in process table, save process context, select new RUNNABLE process, restore context.

Signup and view all the flashcards

Blocked Process

Marked when a process cannot continue running. Reasons include exiting, waiting for I/O operations, or exhausting its allocated time slice.

Signup and view all the flashcards

Scheduling Algorithms

FIFO (First In, First Out) and SJF (Shortest Job First). Scheduling algorithms dictating the order in which to run queued processes.

Signup and view all the flashcards

Physical Address Formula

Calculates the physical memory address by combining the page's starting address (FrameNumber * PageSize) with the offset within the page.

Signup and view all the flashcards

MMU (Memory Management Unit)

Translates virtual addresses (used by the CPU) into physical addresses (used by memory).

Signup and view all the flashcards

Valid Bit (V Bit)

Indicates whether a page is currently located in physical memory.

Signup and view all the flashcards

RO/W Bits

Indicates if a page can be written to.

Signup and view all the flashcards

Dirty & Used Bits

Track modifications made and access.

Signup and view all the flashcards

Disk Address (Page Table)

Links a page in virtual memory to its corresponding location on the disk when it is not in RAM.

Signup and view all the flashcards

Page Fault

A memory access attempt that fails because the page is not in physical memory (V bit is 0).

Signup and view all the flashcards

Paging In

Process of retrieving a page from disk and placing it into physical memory.

Signup and view all the flashcards

Page Table Entry

The page table entry contains a 'valid' bit and a 'page frame' or 'disk address'.

Signup and view all the flashcards

Offset

The formula to calculate the physical address includes a offset.

Signup and view all the flashcards

FrameNumber * PageSize

The formula to calculate the physical address includes a FrameNumber and page size.

Signup and view all the flashcards

CPU vs. Memory Addresses

The CPU uses virtual addresses, while memory uses physical addresses.

Signup and view all the flashcards

V Bit = 0

Indicates page is not currently in memory.

Signup and view all the flashcards

V Bit = 1

Indicates page is currently in memory.

Signup and view all the flashcards

Paging Disk

An area on disk used to store pages that are not currently in physical memory.

Signup and view all the flashcards

Study Notes

Parts of a computer

  • RAM, CPU, and I/O Devices are basic parts of a computer.
  • The "Zero Page" in RAM contains the interrupt vector, I/O, and BIOS/ROMs if present and starts at memory address 0x00...00.
  • The other end of the RAM ends at memory address 0x??...??.

Tools at the Hardware Architecture Level

  • The program counter (PC), stack pointer/frame pointer, processor status register, general purpose registers, memory management unit, kernel/user mode, and interrupts/interrupt vector are tools at the hardware architecture level.

Interrupt Vector and Service Routines

  • An interrupt vector links devices to service routines.
  • A basic instruction cycle of the ALU of the CPU includes fetching the instruction pointed to by the PC, incrementing the PC, and executing the instruction, repeating the cycle.
  • The processor status is stored in a special register on each CPU.
  • User mode can execute most instructions but not I/O, while kernel mode can execute all user instructions, access special instructions, and control I/O and memory access, also called supervisor mode.
  • The interrupt vector in RAM links hardware interrupts with interrupt service routines.

Processes and Memory

  • User Space contains processes P1, P2, P3 and P4 and shared memory.
  • Interrupts or traps link User Space to Kernel Space
  • Kernel Space includes the process table entry, run queue, interrupt service routines, and hardware.

Program Example (Machine Code)

  • Assembler code can include instructions like load, incr, store, jmp, decr, rsb, and zero.
  • Op Codes include load (0x1), store (0x2), incr (0x3), decr (0x4), jmp (0x5), jsr (0x6), rsb (0x7), and zero (0x8).
  • Example Registers: R0, R1, R2, R3, SP, PC

Context Switch and Memory Residence

  • A context switch changes from one running program to another "on the fly" and makes sure you change back later.
  • To make a context switch the "program state" must be saved and involves saving program counter, general purpose registers, status register and stack pointer
  • Each program must be resident in different parts of memory.

Interrupts

  • An interrupt includes hardware-generated jump to subroutine (JSR) from external hardware.
  • Interrupts are defined through interrupt vector, which resides in physical memory and is an array of function pointers.
  • Interrupts may be delayed by masking off.

Interrupt Steps

  • During an interrupt, the PC is saved on the stack, the CPU switches to Kernel mode, and the PC is loaded from the vector using hardware ID.
  • All registers should be saved during an interrupt and execution continues.
  • To return from interrupt, registers must be restored, saved PC value should be restored, and CPU is set to its previous mode.

Critical Sections

  • A critical section contains references to data shared between two or more "threads of control".
  • One may be an interrupt, there may be two or more processes, and there may be two or more threads
  • Must manage the data so all parties can rely on its value and if it is not data may be wrong or corrupted.

Device Drivers

  • Modern UNIX-type systems have block, network, and character device drivers.
  • Block device drivers read/write blocks (disc, tapes, SD cards, CD-ROM/DVD)
  • Network device drivers are local area network (Ethernet, token ring)
  • Character device drivers includes serial ports, display/keyboard, mouse, joystick, touchscreen.

Device Driver Functions

  • Top Half device driver functions communicate with user and kernel, includes probe, open, close, read and write.
  • probe checks for hardware at boot time.
  • open is called when a process does an open of a device file.
  • close is called when a process does a close() of the file descriptor.
  • read transfers data from device to process.
  • write queues data for device to output.
  • Bottom Half device driver functions handle events using an interrupt service routine which when device generates an interrupt and does the I/O on the hardware.

Circular Queue

  • A circular Queue or Ring buffer can have multiple char values in its array.

Critical Sections in Device Drivers

  • Interrupts can be masked off to prevent second interrupt from over-writing the first using the spltty() function.
  • splx(int prevState) returns the interrupt mask to the previous mask.
  • A process can be “put to sleep" until there is space in a buffer using tsleep() for thread
  • wakeup() un-blocks all threads that are asleep and have have the given identifier.

Process Execution and Environment

  • The execution of a program (an "image") is a process.
  • The O/S provides the process with an simplified environment or pseudo-computer.
  • The UNIX/Mach process environment includes virtual address space, process context with no direct access to I/O ports

Process Context

  • The process table contains an entry for each current process with usually one process table entry per thread.
  • Each entry holds information about a process, including process (thread) context, program counter, registers, stack pointer, virtual address space reference, and scheduling information consisting of blocked, runnable, and running states, plus priority and time used.

Synchronization Primitives

  • Shared data can be used between processes/threads, requiring critical sections management.
  • The two most popular synchronization primitives are mutexes where a critical section only allows 1 process at a time and semaphores which allow N-at-a-time

Mutex Implementation

  • Mutexes bracket a critical section so only one process is allowed at a time, using critical_begin() and critical_end()
  • Semaphores allow N-at-a-time to section code using signal increments an internal counter and wait until the internal counter > 0.
  • Commercial/professional implementations use tsleep() to block processes instead of busy-loops.

Semaphore Producer/Consumer

  • Available_sem = QSIZE
  • Used_sem = 0
  • critical_sem = 1
  • Can use SEM_WAIT(&sem) and SEM_SIGNAL(&sem)

Dekker's Algorithm

  • Dekker's Algorithm can implement mutual exclusion (in Hardware)

Semaphore Hints

  • Semaphores must be properly initialized and must have wait_sem() and signal_sem() defined, generally on the same semaphore.
  • The order of wait_sem() operations is important; the order of signal is less so.

Deadlock Condition

  • Deadlock happens when processes hold resources then require resources that other processes hold, shown by a cycle in request allocation graph.

Java and Synchronization

  • The synchronized keyword can be used on a whole method or a block to provide a critical section.
  • The synchronized keyword enables Method locking and block locking.

Interprocess Communication (IPC)

  • IPC uses shared memory, semaphores/mutexes, signals, and pipes.
  • Shared Memory are blocks of shared process image
  • Semaphores/Mutexes are integer data values for flow control
  • Signals are a software “interrupt"
  • Pipes are an imitation file shared by two processes

Signals

  • Signals indicate an important event has happened and include a sequence of events like process A running performing some task when process B sends a signal to process A which interrupts whatever A is doing for signal handler, returning it was doing before
  • There is no direct notification to process B that anything has been done

Signals Values

  • Signals are integer valued actions similar to interrupts.
  • Common signals include:
    • 1 HUP hangup
    • 2 INT interrupt
    • 3 QUIT quit
    • 4 ILL illegal instruction
    • 5 TRAP trace trap
    • 9 KILL kill process
    • 7 BUS bus error
    • 11 SEGV segmentation violation
    • 30 PWR power failure
    • 15 TERM terminate process
    • 10 USR1 user defined #1
    • 12 USR2 user defined #2
  • Numbers vary between platform.

Pipes

  • A pipe is a file descriptor created between processes.

Scheduling

  • The basic process scheduler loop happens when a process exits, waits for I/O, or finishes a time slice.
  • The mark process is either runnable or blocked and records why processes get blocked and saves context in the process table entry.
  • The scheduler then searches the process table for another runnable process, marking it "running" the restoring context from the table and CPU starts executing the the process from where it left off

Scheduling Algorithms

  • Scheduling algorithms include FIFO and SJF.
  • FIFO has jobs/es/...repeatedly join the queue this is typically called "round robin" which is usually preemptive.
  • SJF uses the shortest job first which is not preemptive.

Scheduling Algorithm Evaluation

  • FIFO and round robin are fair since jobs avoid waiting forever.
  • SJF is optimal for throughput, will finish more jobs and is run in the shortest time.
  • SJF is unfair and impractical for processes and is approximated in processes

Scheduling Algorithms/Queuing Disciplines

  • Preemptive schedulers will perform better for interactive systems than non-preemptive schedulers
  • Schedulers will bias towards short jobs like updating an editor keystroke
  • Operators/users will be able to set/adjust priorities for jobs
  • Dynamic priority is updated is updated during context switch
  • There's always a tradeoff between the coarse and fine granularity of the time-slices.
    • Coarse gives low overhead/poor interactive response
    • Fine gives higher overhead/better interactive response

Processor Sharing vs FIFO

  • If preemption occurs extremely frequently such that each job gets an infinitesimally small time each time it runs, the discipline is called "processor sharing”.
  • If the preemption time is infinitely large, the discipline is called FIFO.

Types of tasks

  • Batch tasks are insensitive to gaps in runtime.
  • Interactive tasks are sensitive to runtime gaps and have lots of I/O.
  • Real-time is critical and requires a fixed fraction of CPU/unit time.

Priority Queues

  • Priority queues can range from 1 to 3, where 1 is the highest queue
  • Some systems vary the priority dynamically, others do not

Unix Process Image

  • stack grows downward and is at 0xFFFFFFFF
  • text contains executable code
  • data contains static data
  • symbol table lists symbols, text, constants
  • shared with other processes
  • text segment.
  • dynamic data and bss grows upward
  • at 0x00000000

Process Image

  • Process image is unique to process.
  • Processes can clone using fork(), which copies data, the pointer to shared libs, readonly portions, and text.
  • Threads can be created using POSIX which shares most data, copies the stack, and uses local variables.
  • threads use co-operative multitasking instead of preemptive multitasking.

Protected Virtual Addressing

  • Programs sees its own only virtual addresses, while the kernel sees/manages all address spaces.
  • One program cannot interfere with other memory programs.
  • Protected virtual addressing avoids large space requirement, divides programs into pages only needed pages are kept in real memory

Process image and logical page

  • Process image is sliced into pages independent of data arrangement
  • The "page + offset" relates to the logical position of a byte.
  • The MMU translates virtual to physical addresses

MMU Address Translation

  • Processes are divided into pages (which are like slices of bread)
  • VirtualAddress/PageSize = VirtualPageNumber
  • VirtualAddress%PageSize = PageOffset Number
  • Use virtual page number to look up the frame number for the page number in the page table.
  • (FrameNumber x PageSize) + Offset = PhysicalAddress

MMU and Memory

  • CPU to MMU to Memory.
  • The CPU sends a virtual address to the MMU, which translates it into a physical address and accesses the correct location in memory.

Valid and Invalid Memory

  • The hardware page table contains information per page, with page frame number, whether page is "valid", writeability bits R/O or W, and other used bits.
  • The in-memory page table contains a disk address if page is out.
  • A valid bit indicates whether the page is in memory.
  • The top of the stack indicate process stack, bottom of the heap

Paing Disk

  • The main memory, physical address, and paging disk also includes hex addresses describing the data stored there.

Examples

  • The slide deck goes into multiple examples demonstrating how paged memory works, and the specific steps the operating system goes through to find data using hex.

Page Fault Handling

  • "If address is invalid terminate process
  • Else If page frame isn't valid, use the frame
  • Else choose a page to be replaced
    • If page modified save page on disk
  • If required page is saved, read the page in
  • Else text or intialized data, read from executable file
  • Else initialize to Zeros (Security)
  • Set up page table
  • Mark RUNNABLE process

Page Fault Timeline

if address mapping fails and causes a page fault, process must be blocked and wait.

  • Other processes can run if they can use runnable.
  • The page faults need to be managed, as they increase the overall number.
  • Faults will always cause some major interruption.
  • If no processes are runnable, the CPU will become idle

Virtual Memory

  • Paged Virtual Memory depends on the locality principle:
    • Locality principle enables programs to only use a small portion of the total address space needed.
  • The set of pages that make up this portion is called the working set.
  • The pages that are actually on real memory are called the resident set.

Page Replacement Policy

  • The ideal policy to decide which one to remove the page from real memory is the page replacement policy
  • The goal of the policy is to ensure the working set is in the resident set.
  • The best of deciding and finding the perfect policy is using process strings on a real program to find a process that causes a [page fault](page fault).

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

Description

This quiz covers fundamental concepts in operating systems, including the instruction cycle, kernel mode, interrupt vectors, user and kernel space interaction, machine code interpretation, and process synchronization using semaphores. It tests understanding of system architecture and resource management.

More Like This

Introduction to Operating Systems
18 questions
Operating Systems chapter-1
48 questions
Operating System Kernel and User Mode
45 questions
Use Quizgecko on...
Browser
Browser