Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
25_26_27_28 (1).docx
Скачиваний:
0
Добавлен:
01.05.2025
Размер:
32.57 Кб
Скачать

Экзаменационный билет № 25

1. Scheduling : Scheduling criteria's ОС.

2. Paging : FIFO ,MIN,LRU, Second chance, Enhanced second chance

3. OS File Operations

  1. Scheduling : Scheduling criteria's ос.

Operating systems often utilize two types of schedulers: a long-term scheduler and a short-term scheduler.

Short term schedulers determine which process to run in a given time interval. Short term schedulers can be either non-preemptive, requiring tasks to explicitly give up the CPU when they are done, or preemptive where the OS scheduler can interrupt running processes and change their scheduling order.

There are several criteria to design a scheduler for. A scheduler should generally maximize CPU utilization – keeping the CPU as busy as possible generally leads to more work being completed. The throughput of a system is a measure of how many jobs are finished in a unit time. The turn around time is the amount of time which elapses from when a job arrives until it is completed. The waiting time of a process is how long a job spends sitting in the ready queue (e.g. the time spent not actively running or performing I/O). Finally response time is a criteria important for many interactive jobs. Response time measures the time from when a process is ready to run until its next I/O activity. As an example, this corresponds to the delay between when keys are pressed on the keyboard (an I/O activity) and when characters appear on the screen. Ideally, a scheduler would optimize all of these criteria, but in practice most schedulers must optimize a few at the expense of others.

  1. Paging : fifo ,min,lru, Second chance, Enhanced second chance

Page Replacement Algorithms

• FIFO: First-In, First-Out. Throw out the oldest page. Simple to

implement, but the OS can easily throw out a page that is being

accessed frequently.

• MIN: (a.k.a. OPT) Look into the future and throw out the page

that will be accessed farthest in the future

• LRU: Least Recently Used. Approximation of MIN that works

well if the recent past is a good predictor of the future. Throw out

the page that has not been used in the longest time.

  • Second Chance Algorithm:

Use a single reference bit per page.

1. OS keeps frames in a circular list.

2. On a page fault, the OS

a) Checks the reference bit of the next frame.

b) If the reference bit is ‘0’, replace the page, and set its bit to ‘1’.

c) If the reference bit is ‘1’, set bit to ‘0’, and advance the pointer to the next frame

  • Enhanced Second Chance

• It is cheaper to replace a page that has not been written

– OS need not be write the page back to disk

=> OS can give preference to paging out un-modified pages

• Hardware keeps a modify bit (in addition to the reference bit)

‘1’: page is modified (different from the copy on disk)

‘0’: page is the same as the copy on disk

  1. Os File Operations

File Operations: Creating a File

• Create(name)

– Allocate disk space (check disk quotas, permissions, etc.)

– Create a file descriptor for the file including name, location on disk, and all

file attributes.

– Add the file descriptor to the directory that contains the file.

– Optional file attribute: file type (Word file, executable, etc.)

• Delete(name)

– Find the directory containing the file.

– Free the disk blocks used by the file.

– Remove the file descriptor from the directory.

• fileId = Open(name, mode)

– Check if the file is already open by another process. If not,

• Find the file.

• Copy the file descriptor into the system-wide open file table.

– Check the protection of the file against the requested mode. If not ok, abort

– Increment the open count.

– Create an entry in the process's file table pointing to the entry in the system wide

file table. Initialize the current file pointer to the start of the file.

• Close (fileId)

– Remove the entry for the file in the process's file table.

– Decrement the open count in the system-wide file table.

– If the open count == 0, remove the entry in the system-wide file table

• Write is similar to reads, but copies from the buffer to the file.

• Seek just updates fp.

• Memory mapping a file

– Map a part of the portion virtual address space to a file

– Read/write to that portion of memory \implies OS reads/writes from

corresponding location in the file

– File accesses are greatly simplified (no read/write call are necessary)

Экзаменационный билет № 26

1. Scheduling: First Come First Served (FCFS)

2. Paging : the temporal locality and the spatial locality. What effect do these have on the performance of paging?

3. File Access Methods A & Directory Operations

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]