OS: IO

Διάδρομος

Άσκηση

Ένας διάδρομος με ταχύτητα 66 MHz έχει εύρος 32 bit. Ένας άλλος διάδρομος ταχύτητας 33 MΗz έχει εύρος 128 bit. Υπολόγισε το σύνολο των bits που μεταδίδονται ανά δευτερόλεπτο. Ποιος από τους δύο έχει τη δυνατότητα μετάδοσης μεγαλύτερο όγκου δεδομένων και γιατί;

Απάντηση

Η διαμεταγωγή ενός διαδρόμου δίνεται από τον τύπο:

Διαμεταγωγή = Εύρος Διαδρόμου (σε bits) x Ταχύτητα (σε Hz)

Έχουμε:

Άρα ο διάδρομος 2 έχει δυνατότητα μετάδοσης μεγαλύτερου όγκου δεδομένων. Αυτό είναι προφανές και από τα χαρακτηριστικά των διαδρόμων. Ο 2ος, έχει τη μισή ταχύτητα αλλά έχει το 4πλάσιο εύρος, άρα έχει τη διπλάσια ταχύτητα.


Άσκηση

Ένας scanner έχει ταχύτητα μεταφοράς 400 KB/sec. Ένας δίσκος έχει ρυθμό μεταφοράς 16.7 MB/sec και ο δίαυλος στον οποίο είναι συνδεδεμένος έχει την ίδια με αυτόν ταχύτητα. Υπάρχει περίπτωση κατά τη μεταφορά δεδομένων από τον scanner να εμφανιστεί φαινόμενο κορεσμού στον δίαυλο;

Απάντηση

Όχι. Η ταχύτητα μεταφοράς τόσο του δίσκου όσο και του διαύλου είναι πολύ μεγαλύτερη από του scanner.


Exercise

A DMA controller has four channels. The controller is capable of requesting a 32-bit word every 100 nsec. A response takes equally long. How fast does the bus have to be to avoid being a bottleneck?

Απάντηση

Each bus transaction has a request and a response, each taking 100 nsec, or 200 nsec per bus transaction. This gives 5 million bus transactions/sec (1/200nsec). If each one is good for 4 bytes, the bus has to handle 20 MB/sec (5000000x4). The fact that these transactions may be sprayed over four I/O devices in round-robin fashion is irrelevant. A bus transaction takes 200 nsec, regardless of whether consecutive requests are to the same device or different devices, so the number of channels the DMA controller has does not matter. The bus does not know or care.

Δίσκος

Άσκηση

Ένας δίσκος έχει 8 κεφαλές, 256 κυλίνδρους και 128 τομείς ανά κύλινδρο. Αν κάθε τομές έχει 512 bytes.

  1. Ποια είναι η χωρητικότητα του δίσκου;
  2. Αν ο ρυθμός περιστροφής του είναι 2345 rpm και ο χρόνος αναζήτησης track-σε-track είναι 4msec, πόση πρέπει να είναι η υπερπήδηση;
  3. Ποιος είναι ο ρυθμός μεταφοράς δεδομένων;

Απάντηση

  1. Κάνουμε αντικατάσταση στον τύπο: σύνολο κεφαλών×αριθμός κυλίνδρων×αριθμός τομέων/κύλινδρο×ΚB/τομέα. Έχουμε: 8 x 256 x 128 x 512 = 134217728 bytes ή 128MB
  2. Μία περιστροφή γίνεται σε χρόνο 1/2345 του λεπτού ή σε 60/2345 του δευτερολέπτου που δίνει 6.4 msec. Σε μία περιστροφή, από την κεφαλή περνούν 128 τομείς. Δηλαδή, ένας τομέας περνάει από την κεφαλή κάθε 6.4x10-3/128 = 200 μsec. Στη διάρκεια των 4msec περνούν 4x10-3/200x10-6= 20 τομείς από κύλινδρο. Αυτή είναι η υπερπήδηση.
  3. Με ρυθμό 1 τομέα ανά 200 μsec, ο δίσκος μπορεί να διαβάσει 1/200x10-6= 5000 τομείς/sec. Κάθε τομέας έχει 512 bytes, άρα ο ρυθμός μεταφοράς είναι 5000 τομείς/sec x 512 bytes/τομέα = 2.56x106 bytes/sec το οποίο είναι περίπου 2.44 MB/sec (1 MB = 220 bytes, όχι 106).

Άσκηση

Ένας σκληρός δίσκος έχει 64 κεφαλές, 621 κυλίνδρους και 63 τομείς ανά κύλινδρο, ενώ το μέγεθος κάθε τομέα είναι 512 bytes. Ποια η συνολική χωρητικότητά του;


Άσκηση

Ένας σκληρός δίσκος Α έχει 128 κεφαλές, 621 κυλίνδρους και 63 τομείς ανά κύλινδρο, ενώ το μέγεθος κάθε τομέα είναι 512bytes. Ένας δεύτερος σκληρός δίσκος Β έχει 32 κεφαλές, 1242 κυλίνδρους και 63 τομείς ανά κύλινδρο. Το μέγεθος κάθε τομέα είναι 512bytes και στις δύο περιπτώσεις. Τι σχέση έχουν ως προς τη χωρητικότητά τους;


Άσκηση

Έστω ένας σκληρός δίσκος με 32 κεφαλές, 1242 κυλίνδρους και 252 τομείς ανά κύλινδρο. Ο δίσκος έχει χωρητικότητα 5GB περίπου. Ποιο είναι το μέγεθος κάθε τομέα;


Άσκηση

Έστω σκληρός δίσκος με 32 κεφαλές, 310 κυλίνδρους και 63 τομείς ανά κύλινδρο. Το μέγεθος κάθε τομέα είναι 1ΚΒ. Ο δίσκος, διαμορφώνεται από το λειτουργικό σύστημα, ώστε να έχει συνολικά 156.240 συστοιχίες. Πόσοι τομείς ανήκουν σε κάθε συστοιχία;


Exercise

A floppy disk has 40 cylinders. A seek takes 6 msec per cylinder moved. If no attempt is made to put the blocks of a file close to each other, two blocks that are logically consecutive (i.e., follow one another in the file) will be about 13 cylinders apart, on the average. If, however, the operating system makes an attempt to cluster related blocks, the mean interblock distance can be reduced to 2 cylinders (for example). How long does it take to read a 100-block file in both cases, if the rotational latency is 100 msec and the transfer time is 25 msec per block?

Answer

The time per block is built up of three components: seek time, rotational latency, and transfer time. In all cases the rotational latency plus transfer time is the same, 125 msec. Only the seek time differs. For 13 cylinders it is 78 msec; for 2 cylinders it is 12 msec. Thus for randomly placed files the total is 203 msec, and for clustered files it is 137 msec.


Exercise

How much cylinder skew is needed for a 7200-rpm disk with a track-to-track seek time of 1 msec? The disk has 200 sectors of 512 bytes each on each track. Calculate the maximum data rate in MB/sec for the disk.

Answer

The disk rotates at 7200 rpm, so 1 rotation takes 60/7200 = 8.33 msec. With 200 sectors per rotation, one sector passes under the head every 8.33*10-3sec/200 = 41,67 μsec. During the 1-msec seek, 1*10-3/41.67*10-6 = 24 sectors. Thus the cylinder skew should be 24.

The sector time is 41,67 μsec. This means that the disk can read 1 sector / 41.67*10-6 sec = 24,000 sectors/sec. Since each sector contains 512 bytes, the data rate is 24,000 sectors/sec * 512 bytes/sector = 12,288,000 bytes/sec. This rate is 12,288,000/220 MB/sec = 11.7 MB/sec.


Άσκηση

Δίνονται τα παρακάτω χαρακτηριστικά ενός δίσκου:

Ζητούνται:

  1. Η χωρητικότητα του δίσκου
  2. Η υπερπήδηση που πρέπει να έχει
  3. Ο ρυθμός μεταφοράς δεδομένων

Άσκηση

Δίνονται τα παρακάτω χαρακτηριστικά ενός δίσκου:

Ζητούνται:

  1. Η χωρητικότητα του δίσκου
  2. Η υπερπήδηση που πρέπει να έχει
  3. Ο ρυθμός μεταφοράς δεδομένων

Exercise

Disk requests come in to the disk driver for cylinders 10, 22, 20, 2, 40, 6, and 38, in that order. A seek takes 6 msec per cylinder moved. How much seek time is needed for

  1. First-Come, first served.
  2. Closest cylinder next.
  3. SCAN (Elevator algorithm, initially moving upward).
  4. C-SCAN (moves always upward).

In all cases, the arm is initially at cylinder 20.

Απάντηση

Οι μετακινήσεις είναι η απόλυτη διαφορά από τον τρέχον κύλινδρο προς τον επόμενο κύλινδρο. Ο "επόμενος" εξαρτάται από τον αλγόριθμο.

  1. Η σειρά εξυπηρέτησης είναι: 10, 22, 20, 2, 40, 6, 38. Οι μετακινήσεις είναι: (20-10) + (22-10) + (22-20) + (20-2) + (40-2) + (40-6) + (38-6) = 10 + 12 + 2 + 38 + 34 + 32 = 146 κύλινδροι x 6msec = 876 msec
  2. Η σειρά εξυπηρέτησης είναι: 20, 22, 10, 6, 2, 38, 42. Οι μετακινήσεις είναι: (20-20) + (22-20) + (22-10) + (10-6) + (6-2) + (38-2) + (42-38) = 0 + 2 + 12 + 4 + 4 + 36 + 4 = 60 κύλινδροι x 6msec = 360 msec
  3. Η σειρά εξυπηρέτησης είναι: 20, 22, 38, 40, 10, 6, 2. Οι μετακινήσεις είναι: (20-20) + (22-20) + (38-22) + (40-38) + (40-10) + (10-6) + (6-2) = 0 + 2 + 16 + 2 + 30 + 4 + 4 = 58 κύλινδροι x 6msec = 348 msec
  4. Η σειρά εξυπηρέτησης είναι: 20, 22, 38, 40, 2, 6, 10. Οι μετακινήσεις είναι: (20-20) + (22-20) + (38-22) + (40-38) + (40-2) + (6-2) + (10-6) = 0 + 2 + 16 + 2 + 38 + 4 + 4 = 66 κύλινδροι x 6msec = 396 msec.

Exercise

Disk requests come in to the disk driver for cylinders 40, 21, 52, 30, 4, 67, 83 and 35, in that order. A seek takes 4 msec per cylinder moved. How much seek time is needed for

  1. First-Come, first served.
  2. Closest cylinder next.
  3. SCAN (Elevator algorithm, initially moving upward).
  4. C-SCAN (moves always upward).

In all cases, the arm is initially at cylinder 30.

Exercise

Disk requests come in to the disk driver for cylinders 4, 88, 10, 73, 12, 66, 5 and 90, in that order. A seek takes 6 msec per cylinder moved. How much seek time is needed for

  1. First-Come, first served.
  2. Closest cylinder next.
  3. SCAN (Elevator algorithm, initially moving upward).
  4. C-SCAN (moves always upward).

In all cases, the arm is initially at cylinder 70.

Exercise

A RAID can fail if two or more of its drives crash with in a short time interval. Suppose that the probability of one drive crashing in a given hour is p. What is the probability of a k-drive RAID failing in a given hour?

Answer

The probability of 0 failures, P0, is (1 − p)k . The probability of 1 failure, P1, is kp(1 − p)k−1. The probability of a RAID failure is then 1 − P0 − P1. This is 1 − (1 − p)k − kp(1 − p)k−1.

Οθόνη

Άσκηση

Σε μια οθόνη, για κάθε ένα από τα τρία βασικά χρώματα, υπάρχουν 256 στάθμες φωτεινότητας. Πόσα διαφορετικά χρώματα μπορεί να εμφανίσει;

Απάντηση

Γνωρίζουμε ότι κάθε χρώμα είναι μίξη των τριών βασικών. Άρα, συνολικά έχουμε:

256x256x256=16777216 (17 περίπου εκατομμύρια)


Άσκηση

Μια οθόνη ονομαστικής διαγωνίου 15 ιντσών, έχει ορατό πλαίσιο με διαστάσεις 30x23 cm και βήμα κουκίδας 0.25mm. Ποια είναι η μέγιστη οριζόντια ανάλυση και ποια η μέγιστη κατακόρυφη που μπορεί να έχει;

Απάντηση

Οριζόντια: 30cm/0.25mm=1200 εικονοστοιχεία

Κάθετη: 23cm/0.25mm=920 εικονοστοιχεία


Άσκηση

Έστω μια οθόνη καθοδικού σωλήνα (CRT) ορατού πλαισίου 25×25 cm με βήμα κουκκίδας 0,28mm. Ποια είναι η μέγιστη ανάλυση που μπορεί να απεικονίσει;

  1. 800x600
  2. 1024x768
  3. 1280x1024
  4. 640x480

Απάντηση

Οριζόντια: 25cm/0.28mm=892 εικονοστοιχεία

Κάθετη: 25cm/0.28mm=892 εικονοστοιχεία

Η μέγιστη ανάλυση που μπορεί να απεικονίσει είναι 800x600.


Άσκηση

Αν το πλαίσιο οθόνης έχει διαστάσεις 640x480 και χρησιμοποιούνται 24 bit για κάθε εικονοστοιχείο (8 bits για καθένα από τα τρία βασικά χρώματα), τότε πόση είναι η μνήμη του υποσυστήματος γραφικών;

Απάντηση

Το μέγεθος δίνεται από το γινόμενο των διαστάσεων του πλαισίου επί τoν αριθμό bits κάθε εικονοστοιχείου για το χρώμα.

Έχουμε, λοιπόν,

640x480x24 bits = 7,372,800 bits = 921.600 bytes


Άσκηση

Ένα υποσύστημα γραφικών με μνήμη 1MB μπορεί να απεικονίσει σε μια οθόνη την ανάλυση 640x480 με 24 bits (βάθος χρώματος) για κάθε εικονοστοιχείο. Με τι βάθος χρώματος μπορεί να απεικονίσει τις αναλύσεις:

Απάντηση

Για την ανάλυση 800x600, έχουμε: 800x600xB=1MB => B = 220Byte/480000 => B=2 Byte => B=16 bits

Με 16 bits βάθος χρώματος μπορούμε να έχουμε 216=65536 διαφορετικά χρώματα.

Για την ανάλυση 1024x768, έχουμε: 1024x768xB=1MB => B = 220Byte/786432 => B=1 Byte => B=8 bits

Με 8 bits βάθος χρώματος μπορούμε να έχουμε 28=256 διαφορετικά χρώματα.


Άσκηση

Mια οθόνη καθοδικού σωλήνα (CRT) έχει οριζόντια συχνότητα σάρωσης 56 KΗz και είναι διαιρεμένη σε 800 γραμμές. Ποια είναι η μέγιστη συχνότητα ανανέωσης πλαισίου που μπορεί να επιτευχθεί;

Απάντηση

Η οριζόντια συχνότητα σάρωσης δίνεται από το γινόμενο της μέγιστη συχνότητα ανανέωσης πλαισίου επί τον αριθμό των γραμμών της οθόνης.

Οριζόντια Συχνότητα = Μέγιστη Συχνότητα Ανανέωσης Πλαισίου x Αριθμός Γραμμών

Εμείς, έχουμε την οριζόντια συχνότητα και τον αριθμό γραμμών. Λύνοντας ως προς την κάθετη συχνότητα είναι:

Μέγιστη Συχνότητα Ανανέωσης Πλαισίου=Οριζόντια Συχνότητα/Αριθμό Γραμμών=56000Hz/800=70Hz


Άσκηση

O κατασκευαστής μιας οθόνης καθοδικού σωλήνα (CRT) αναφέρει πως η οθόνη του έχει βήμα κουκίδας 0,21 mm, ενώ το ορατό πλαίσιο είναι 30×21,5 cm. Επιπλέον η μέγιστη συχνότητα οριζόντιας σάρωσης είναι 74ΚHz. Ο κατασκευαστής ισχυρίζεται πως η οθόνη αυτή υποστηρίζει αναλύσεις 1200×1024 με συχνότητα ανανέωσης πλαισίου 90 Hz. Είναι δυνατό να φτάσει η οθόνη αυτή την ανάλυση και αν ναι, είναι πλεκτή ή άπλεκτη η σάρωση για τα 90Hz;

Απάντηση

Οριζόντια ανάλυση: 30cm/0.21mm=1428 pixel
Κάθετη ανάλυση: 21.5cm/0.21mm=1023 pixel

Όσον αφορά την ανάλυση ο ισχυρισμός ισχύει. Η κάθετη ανάλυση μας δίνει το πλήθος των γραμμών της οθόνης, δηλαδή 1023.

Η μέγιστη συχνότητα ανανέωσης πλαισίου είναι: Μέγιστη Συχνότητα Ανανέωσης Πλαισίου = Οριζόντια Συχνότητα / Αριθμό Γραμμών = 74000Hz/1023 = 72Hz.

Αυτή είναι η μέγιστη συχνότητα πλαισίου που μπορεί να επιτευχθεί σε άπλεκτη σάρωση. Άρα, ο ισχυρισμός του κατασκευαστή για 90Hz ισχύει μόνο για πλεκτή σάρωση.


Άσκηση

Αν το υποσύστημα γραφικών που συνδέεται με την παραπάνω οθόνη, έχει συνολική μνήμη 2ΜΒ, πόσα διαφορετικά χρώματα μπορούν να απεικονιστούν σε ανάλυση 1024×768;

Απάντηση

Η μνήμη δίνεται από το γινόμενο του πλαισίου της οθόνης επί το βάθος χρώματος. Έτσι, έχουμε:

Οριζόντια x Κάθετη x Βάθος = Μνήμη => Βάθος = 2ΜΒ/(1024x768) = 2x220 Bytes/786432 = 2x220x8 bits/786432=16777216/786432 => Βάθος = 21 bits

Το πλήθος των χρωμάτων που μπορούν να απεικονιστούν είναι: 221, περίπου 2 εκατομμύρια.


Exercise

A bitmap terminal contains 1280 by 960 pixels. To scroll a window, the CPU (or controller) must move all the lines of text upward by copying their bits from one part of the video RAM to another. If a particular window is 60 lines high by 80 characters wide (4800 characters, total), and a character’s box is 8 pixels wide by 16 pixels high, how long does it take to scroll the whole window at a copying rate of 50 nsec per byte? If all lines are 80 characters long, what is the equivalent baud rate of the terminal? Putting a character on the screen takes 5 µsec. How many lines per second can be displayed?

Answer

The window's geometry is 80x8 = 640 pixels wide and 60x16 = 960 pixel high. That give us a total of 640x960=614400 pixel. If we have 24 bits (3 bytes) per color, window's total need in memory is 614400x3=1843200 bytes. Scrolling the window at a rate of 50 nsec per byte needs 50x10-9x1843200=1,8432x10-3=1,8432 msec.

Writing 80 characters to the screen takes 80x5 μsec= 400 μsec. So, scrolling and displaying a new line take 1,8432 msec + 400 μsec = 2.2432 msec. This gives about 1/2.2432x10-3=445,79 lines/sec.


Exercise

On the original IBM PC’s color display, writing to the video RAM at any time other than during the CRT beam’s vertical retrace caused ugly spots to appear all over the screen. A screen image is 25 by 80 characters, each of which fits in a box 8 pixels by 8 pixels. Each row of 640 pixels is drawn on a single horizontal scan of the beam, which takes 63.6 µsec, including the horizontal retrace. The screen is redrawn 60 times a second, each of which requires a vertical retrace period to get the beam back to the top. What fraction of the time is the video RAM available for writing in?

Answer

The 25 lines of characters, each 8 pixels high, requires 200 scans to draw. There are 60 screens a second, or 12,000 scans/sec. At 63.6 μsec/scan, the beam is moving horizontally 763 msec per second, leaving 237 msec for writing in the video RAM. Thus the video RAM is available 23.7% of the time.


Exercise

One way to place a character on a bitmapped screen is to use bitblt from a font table. Assume that a particular font uses characters that are 16 × 24 pixels in true RGB color.

  1. How much font table space does each character take?
  2. If copying a byte takes 100 nsec, including overhead, what is the output rate to the screen in characters/sec?

Answer

  1. Each pixel takes 3 bytes in RGB, so the table space is 16 × 24 × 3 bytes, which is 1152 bytes.
  2. At 100 nsec per byte, each character takes 1152 / 100*10-9 = 115.2 μsec. This gives an output rate of about 1 char/115.2 μsec = 8681 chars/sec.

Exercise

Assuming that it takes 10 nsec to copy a byte, how much time does it take to completely rewrite the screen of an 80 character × 25 line text mode memory-mapped screen? What about a 1024 × 768 pixel graphics screen with 24-bit color?

Answer

Rewriting the text screen requires copying 80×25=2000 bytes, which can be done in 2000×10-9 = 20 μsec. Rewriting the graphics screen requires copying 1024 × 768 × 3 = 2,359,296 bytes, or about 2,359,296×10-9 = 23.6 msec.

Εκτυπωτής

Άσκηση

Ένας εκτυπωτής laser έχει ονομαστική ταχύτητα 20 σελίδων το λεπτό. Αν έχουμε ένα κείμενο 100 διαφορετικών σελίδων, είναι δυνατόν η εκτύπωση να ολοκληρωθεί σε 5 λεπτά; Αιτιολόγησε την απάντησή σου.

Απάντηση

Η ονομαστική ταχύτητα αφορά την ταχύτητα εκτύπωσης πολλαπλών αντιγράφων της ίδιας σελίδας, το οποίο για 100 σελίδες δίνει: 100 σελίδες / 20 σελίδες/λεπτό = 5 λεπτά.

Εμείς, εδώ, έχουμε 100 διαφορετικές σελίδες, έτσι η ταχύτητα εκτύπωσης θα είναι μικρότερη από 20 σελίδες/λεπτό. Κατά συνέπεια ο χρόνος εκτύπωσης όλων των σελίδων θα είναι μεγαλύτερος από 5 λεπτά.

Διακοπές (Interrupts)

Exercise

Suppose that a computer can read or write a memory word in 10 nsec. Also suppose that when an interrupt occurs, all 32 CPU registers, plus the program counter and PSW are pushed onto the stack. What is the maximum number of interrupts per second this machine can process?

Answer

An interrupt requires pushing 34 words onto the stack. Returning from the interrupt requires fetching 34 words from the stack. This overhead alone is (34+34)*10 nsec = 680 nsec. Thus the maximum number of interrupts per second is no more than about 1/680*109 = 1.47 million, assuming no work for each interrupt.


Exercise

A typical printed page of text contains 50 lines of 80 characters each. Imagine that a certain printer can print 6 pages per minute and that the time to write a character to the printer’s output register is so short it can be ignored. Does it make sense to run this printer using interrupt-driven I/O if each character printed requires an interrupt that takes 50 µsec all-in to service?

Answer

The printer prints 50 × 80 × 6 = 24,000 characters/min, which is 400 characters/sec. Each character uses 50 μsec of CPU time for the interrupt, so collectively in each second the interrupt overhead is 20 msec. Using interrupt-driven I/O, the remaining 980 msec of time is available for other work. In other words, the interrupt overhead costs only 2% of the CPU, which will hardly affect the running program at all.


Exercise

A local area network is used as follows. The user issues a system call to write data packets to the network. The operating system then copies the data to a kernel buffer. Then it copies the data to the network controller board. When all the bytes are safely inside the controller, they are sent over the network at a rate of 10 megabits/sec. The receiving network controller stores each bit a microsecond after it is sent. When the last bit arrives, the destination CPU is interrupted, and the kernel copies the newly arrived packet to a kernel buffer to inspect it. Once it has figured out which user the packet is for, the kernel copies the data to the user space. If we assume that each interrupt and its associated processing takes 1 msec, that packets are 1024 bytes (ignore the headers), and that copying a byte takes 1 µsec, what is the maximum rate at which one process can pump data to another? Assume that the sender is blocked until the work is finished at the receiving side and an acknowledgement comes back. For simplicity, assume that the time to get the acknowledgement back is so small it can be ignored.

Answer

A packet must be copied four times during this process, which takes 4.1 msec. There are also two interrupts, which account for 2 msec. Finally, the transmission time is 0.83 msec, for a total of 6.93 msec per 1024 bytes. The maximum data rate is thus 147,763 bytes/sec, or about 12 percent of the nominal 10 megabit/sec network capacity. (If we include protocol overhead, the figures get even worse.)


Exercise

The clock interrupt handler on a certain computer requires 2 msec (including process switching overhead) per clock tick. The clock runs at 60 Hz. What fraction of the CPU is devoted to the clock?

Answer

Two msec 60 times a second is 120 msec/sec, or 12 percent of the CPU.


Exercise

Many versions of UNIX use an unsigned 32-bit integer to keep track of the time as the number of seconds since the origin of time. When will these systems wrap around (year and month)? Do you expect this to actually happen?

Answer

The number of seconds in a mean year is 365.25 × 24 × 3600. This number is 31,557,600. The counter wraps around after 232 seconds from 1 January 1970. The value of 232/31,557,600 is 136.1 years, so wrapping will happen at 2106.1, which is early February 2106. Of course, by then, all computers will be at least 64 bits, so it will not happen at all.


Exercise

Consider the performance of a 56-Kbps modem. The driver outputs one character and then blocks. When the character has been printed, an interrupt occurs and a message is sent to the blocked driver, which outputs the next character and then blocks again. If the time to pass a message, output a character, and block is 100 µsec, what fraction of the CPU is eaten by the modem handling? Assume that each character has one start bit and one stop bit, for 10 bits in all.

Answer

Στα 56 Kbps, έχουμε 56000/10=5600 bytes/sec (εδώ ισχύει 1byte=10bits) ή χαρακτήρες. Για κάθε χαρακτήρα έχουμε 1 interrupt, έτσι, συνολικά έχουμε 5600 interrupts/sec. Ο χρόνος για το πέρασμα μηνύματος, εκτύπωση χαρακτήρα και απενεργοποίησης είναι 100μsec. Αυτό μας δίνει χρόνο 5600x100x10-6=0.56 sec. Στο ένα δευτερόλεπτο, τα 0.56 δευτερόλεπτα (ή το 56% του χρόνου) αφιερώνονται στο χειρισμό του modem.

Page last modified on 29-08-2008 (09:49)