I/O Management and Disk Schedulingإدارة الإدخال والإخراج وجدولة القرص

الشريحة 1 من 13

مقدمة الفصل

ماذا ستتعلم في هذا الفصل

  1. I/O devices: the three categories and how devices differ.
  2. Organization of the I/O function: programmed I/O, interrupt-driven I/O, DMA and its configurations.
  3. Operating system design issues (efficiency, generality, hierarchical design) and I/O buffering.
  4. Disk performance parameters and disk scheduling policies: FIFO, priority, LIFO, SSTF, SCAN, C-SCAN, N-step-SCAN, FSCAN.
تفاصيل المصدرشرائح الفصل 3c · الشريحة ⁦2⁩
المصدر
شرائح الفصل 3c · الشريحة ⁦2⁩

Categories of I/O deviceفئات الأجهزة

  • A difficult area of OS design: a consistent solution is hard because of the wide variety of devices and applications.
Three categories (slides 3–6)
CategoryالفئةUsed to communicate withللتواصل معExamples (slides 4–6)أمثلة
Human readableThe user
  • Printers and terminals
  • video display
  • keyboard
  • mouse
Machine readableElectronic equipment
  • Disk drives
  • USB keys
  • sensors
  • controllers
  • actuators
CommunicationRemote devices
  • Digital line drivers
  • modems

A temperature sensor connected to a computer belongs to which category of I/O device?

تفاصيل المصدرشرائح الفصل 3c · الشرائح ⁦3–6⁩
المصدر
شرائح الفصل 3c · الشرائح ⁦3–6⁩

Differences in I/O devicesاختلافات الأجهزة

ستة أوجه اختلاف.

  1. Data rate
  2. Application
  3. Complexity of control
  4. Unit of transfer
  5. Data representation
  6. Error conditions

Which statement about the unit of transfer is correct?

تفاصيل المصدرشرائح الفصل 3c · الشرائح ⁦7–13⁩
المصدر
شرائح الفصل 3c · الشرائح ⁦7–13⁩

Techniques for performing I/Oتقنيات الإدخال والإخراج

Table 11.1 I/O Techniques (slide 15)
No interruptsدون مقاطعاتUse of interruptsباستخدام المقاطعات
I/O-to-memory transfer through processorProgrammed I/OInterrupt-driven I/O
Direct I/O-to-memory transferلا تذكر الشرائح شيئًا هنا.Direct memory access (DMA)

In Table 11.1, which cell is left empty?

تفاصيل المصدرشرائح الفصل 3c · الشريحة ⁦15⁩
المصدر
شرائح الفصل 3c · الشريحة ⁦15⁩

DMA configurationsتشكيلات DMA

Single busناقل واحد
All modules share the same system bus.
Integrated DMA & I/ODMA مدمج مع الإدخال والإخراج
A direct path between DMA and I/O modules — this substantially cuts the required bus cycles.
I/O busناقل الإدخال والإخراج
Reduces the number of I/O interfaces in the DMA module.

Which DMA configuration reduces the number of I/O interfaces in the DMA module?

تفاصيل المصدرشرائح الفصل 3c · الشرائح ⁦16–18⁩
المصدر
شرائح الفصل 3c · الشرائح ⁦16–18⁩

Design issues: efficiency and generalityقضايا التصميم

OS design issues and I/O buffering

Efficiency (slide 20)

  • Most I/O devices are extremely slow compared to main memory; I/O cannot keep up with processor speed.
  • Multiprogramming lets some processes wait on I/O while another executes.
  • Swapping brings in ready processes — but swapping is an I/O operation itself.

Generality (slide 21)

  • Handle all I/O devices in a uniform manner; hide most details in lower-level routines.
  • Hard to completely generalize, but a hierarchical modular design can be used.
Hierarchical design (slide 22)
An OS organized into layers: each layer relies on the next lower layer for more primitive functions and provides services to the next higher layer; changes in one layer should not require changes in other layers.

In a hierarchical (layered) OS design, what should a change in one layer require?

تفاصيل المصدرشرائح الفصل 3c · الشرائح ⁦20–22⁩
المصدر
شرائح الفصل 3c · الشرائح ⁦20–22⁩

I/O bufferingالتخزين المؤقت

  • Processes must wait for I/O to complete before proceeding.
  • To avoid deadlock, certain pages must remain in main memory during I/O.
  • It may be more efficient to perform input transfers in advance of requests and output transfers some time after the request is made.
تفاصيل المصدرشرائح الفصل 3c · الشريحة ⁦24⁩
المصدر
شرائح الفصل 3c · الشريحة ⁦24⁩

Disk performance parametersأداء القرص

  • When operating, the disk is rotating at constant speed.
  • Track selection: moving the head (movable-head system) or electronically selecting one head (fixed-head system).

المسألة

Access time (slide 28).

المعطيات

Seek time
time to position the head at the desired track
Rotational delay (latency)
time for the beginning of the sector to reach the head

الصيغة

Access time = seek time + rotational delay

النتيجة

Transfer time — the time taken to transfer the data — comes after the access.

Which time is the time it takes to position the head at the desired track?

تفاصيل المصدرشرائح الفصل 3c · الشرائح ⁦26–28⁩
المصدر
شرائح الفصل 3c · الشرائح ⁦26–28⁩

FIFO, priority and LIFOFIFO والأولوية وLIFO

Disk scheduling: FIFO, priority, LIFO

Comparison setup (slide 29)

  • Head initially at track 100; disk with 200 tracks.
  • Requests in the order received: 55, 58, 39, 18, 90, 160, 150, 38, 184.
FIFO
Process requests sequentially; fair to all processes; approaches random scheduling in performance if there are many processes.
Priority
Goal is not to optimize disk use but to meet other objectives: short batch jobs may have higher priority; good interactive response; longer jobs may wait an excessively long time; a poor policy for database systems.
LIFO
Good for transaction processing systems; the device goes to the most recent user → little arm movement; possibility of starvation since a job may never regain the head of the line.

Which disk scheduling policy is described as good for transaction processing systems but at risk of starvation?

تفاصيل المصدرشرائح الفصل 3c · الشرائح ⁦29–32⁩
المصدر
شرائح الفصل 3c · الشرائح ⁦29–32⁩

SSTF, SCAN and C-SCANSSTF وSCAN

Disk scheduling: SSTF, SCAN, C-SCAN, N-step-SCAN, FSCAN

SSTF (Shortest Service Time First)
Select the request that requires the least movement of the disk arm from its current position — always choose the minimum seek time.
SCAN
The arm moves in one direction only, satisfying all outstanding requests, then the direction is reversed.
C-SCAN
Restricts scanning to one direction only; after the last track in that direction, the arm is returned to the opposite end and the scan begins again.

After serving the last track in its direction, what does C-SCAN do?

تفاصيل المصدرشرائح الفصل 3c · الشرائح ⁦33–35⁩
المصدر
شرائح الفصل 3c · الشرائح ⁦33–35⁩
ملاحظات حول المصدر (1)
  • الشريحة 34 تقول «حتى آخر مسار في ذلك الاتجاه»، بينما جدول الشريحة 38 يعكس اتجاه SCAN عند آخر مسار مطلوب (184 ثم 90).

N-step-SCAN and FSCANN-step وFSCAN

Disk scheduling: SSTF, SCAN, C-SCAN, N-step-SCAN, FSCAN

N-step-SCAN

  • Segments the disk request queue into subqueues of length N
  • Subqueues are processed one at a time, using SCAN
  • New requests are added to another queue while a queue is processed

FSCAN

  • Two subqueues
  • When a scan begins, all requests are in one queue, the other empty
  • All new requests go to the other queue; their service is deferred until all old requests have been processed

In FSCAN, what happens to a request that arrives while a scan is in progress?

تفاصيل المصدرشرائح الفصل 3c · الشرائح ⁦36–37⁩
المصدر
شرائح الفصل 3c · الشرائح ⁦36–37⁩

Performance comparedمقارنة الأداء

Disk scheduling: SSTF, SCAN, C-SCAN, N-step-SCAN, FSCAN

Comparison of disk scheduling algorithms (slide 38), starting at track 100
PolicyالسياسةOrder of tracks accessed from track 100 (slide 38)ترتيب المسارات من 100Average seek lengthمتوسط طول البحث
FIFO55, 58, 39, 18, 90, 160, 150, 38, 18455.3
SSTF90, 58, 55, 39, 38, 18, 150, 160, 18427.5
SCAN (increasing)150, 160, 184, 90, 58, 55, 39, 38, 1827.8
C-SCAN (increasing)150, 160, 184, 18, 38, 39, 55, 58, 9035.8

المسألة

SSTF from track 100 (slide 38): how is each step chosen?

Same head position and requests (start 50; 30, 70, 60, 20). What are the total tracks traversed with FIFO and with SSTF?

تفاصيل المصدرشرائح الفصل 3c · الشريحة ⁦38⁩
المصدر
شرائح الفصل 3c · الشريحة ⁦38⁩

الخلاصة

تفاصيل المصدر
المصدر
شرائح الفصل 3c

خريطة الفصل

    1. 1مقدمة الفصل
    1. 2Categories of I/O deviceفئات الأجهزة
    1. 3Differences in I/O devicesاختلافات الأجهزة
  1. Techniques for performing I/O and DMA configurationsتقنيات الإدخال والإخراج وتشكيلات DMA

    1. 4Techniques for performing I/Oتقنيات الإدخال والإخراج
    2. 5DMA configurationsتشكيلات DMA
  2. OS design issues and I/O bufferingقضايا التصميم والتخزين المؤقت للإدخال والإخراج

    1. 6Design issues: efficiency and generalityقضايا التصميم
    2. 7I/O bufferingالتخزين المؤقت
    1. 8Disk performance parametersأداء القرص
  3. Disk scheduling: FIFO, priority, LIFOجدولة القرص: FIFO والأولوية وLIFO

    1. 9FIFO, priority and LIFOFIFO والأولوية وLIFO
  4. Disk scheduling: SSTF, SCAN, C-SCAN, N-step-SCAN, FSCANجدولة القرص: SSTF وSCAN وC-SCAN وN-step-SCAN وFSCAN

    1. 10SSTF, SCAN and C-SCANSSTF وSCAN
    2. 11N-step-SCAN and FSCANN-step وFSCAN
    3. 12Performance comparedمقارنة الأداء
    1. 13الخلاصة