A hierarchical memory system that
uses cache memory has cache access
time of 50 nano seconds, main
memory access time of 300 nano
seconds, 75% of memory requests are
for read, hit ratio of 0.8 for read
access and the write-through scheme
is used. What will be the average
access time of the system, both for
read and write requests?
Cache access time = 50 ns
Main memory access time = 300 ns
Percentage of read requests = 75%
Read hit ratio = 0.8
From this, Read miss ratio = 1 - 0.8 = 0.2
In a write-through scheme, data is written to both the cache and the main memory simultaneously.
Average read access time = (read hit ratio x cache access time) +
(read miss ratio x (cache access time + memory access time)
= (0.8 x 50) + (0.2 x (50+300))
= 40 + 70
= 110 ns
With the write-through scheme, the write time is equal to the main memory access time.
Average write access time = 300 ns
Percentage of write request = 100% - percentage of read request = 100% - 75% = 25%
Average access time = (Percentage of read request x average read access time) +
(Percentage of write request x average write access time)
= (75% x 110) + (25% x 300)
= ( (75/100) x 110) + ( (25/100) x 300)
= 82.5 + 75
= 157.5 ns
In a demand paging memory system, page table is held in registers. The time taken to service a page fault is 8 m.sec. if an empty frame is available or if the replaced page is not modified, and it takes 20 m.sec. if the replaced page is modified. What is the average access time to service a page fault assuming that the page to be replaced is modified 70% of the times?
The effective access time (EAT) = (1−P) × M + P × S
where M is memory access time, P is page fault rate and S is page fault service time.
Since there are no details given regarding memory access time, we will consider only the page fault rate and its service time, P x S.
Service a page fault = 8msec.
Page replaced is modified = 20msec.
It is given that 70% of time, replaced page is modified = 70% x 20
It means 30% of time, page replaced is not modified = 30% x 8
Average Effective access time = 70% x 20 + 30% x 8
= (70/100) x 20 + (30/100) x 8
= 14 + 2.4
= 16.4 ms
Consider a system with 12 magnetic tape drives and three processes P1, P2 and P3. Process P1 requires maximum 10 tape drives, P2 may need 4 tape drives and P3 may need upto 9 tape drives. Suppose at time t1, process P1 is holding 5 tape drives, process P2 is holding 2 tape drives and process P3 is holding 3 tape drives. At time t1 the system is in:
Total tapes = 12
At time t1,
P1 holds 5 tapes (maximum requirement = 10)
P2 holds 2 tapes (need = 4)
P3 holds 3 tapes (need = 9)
Total tapes allocated = 10
Balance = Total - allocated = 12-10 = 2 tapes
P1 needs 10-5 = 5 more tapes
P2 needs 4-2 = 2 more tapes
P3 needs 9-3 = 6 more tapes
But there are only 2 tapes available.
We will allocate those 2 available tapes to P2.
After execution, P2 will release all its resources including 4 tapes.
If we allocate 4 tapes to P1 or P3 they cannot complete execution because P1 needs 5 more tapes while P3 needs 6 more tapes.
The system is not in SAFE state.
An unsafe state is a condition where the system is not guaranteed to be able to allocate resources to all processes without potentially leading to a deadlock.
A deadlocked state (a specific unsafe state) occurs when two or more processes are unable to proceed because each process is waiting for a resource that the other process holds.
At time t1, the given details state that the system is in UNSAFE state.
At this point, there is no deadlock. But the unsafe state will subsequently lead to deadlock.
When P1 and P3 are blocked indefinitely, then we can call it as deadlocked state.
Disk Access Time = Average seek time + Average rotational delay + Transfer time + Controller overhead
Given: Average seek time = 8ms
Controller overhead = 2ms
Find average rotational delay and transfer time:
Rotational delay:
Once the head is in the right place, on average we will need to wait for half a rotation of the disk for the correct sector to come under the head. Thus, on average, the rotational latency is half the time it takes the disk to make a complete revolution
7200 rotations for one min => 7200 rotations = 60 sec
Time taken for one full rotation = 60/7200 sec
= 1/120 sec
Average rotational delay = Time taken for one full rotation / 2
= (1 / (120*2)) * 1000 msec
= (1/240) * 1000 msec
7200 rotations for one min => 7200 rotations = 60 sec
Time taken for one full rotation = 60/7200 sec
= 1/120 sec
Average rotational delay = Time taken for one full rotation / 2
= (1 / (120*2)) * 1000 msec
= (1/240) * 1000 msec
Transfer time:
how long it will take to transfer a 512-byte sector
Transfer time = 512 byte / transfer rate (given as 20 MB/sec in question)
= 512 byte / (20 * 2^20 bytes per sec) (20 MB = 1M = 2 power 20)
= (512 / (20 * 2^20)) * 1000 msec
Transfer time = 512 byte / transfer rate (given as 20 MB/sec in question)
= 512 byte / (20 * 2^20 bytes per sec) (20 MB = 1M = 2 power 20)
= (512 / (20 * 2^20)) * 1000 msec
Apply in formula,
Disk access time = Average seek time + Average rotational delay + Transfer time + Controller overhead
= 8ms + (1/240)*1000 ms + (512 / (20* 2^20)) * 1000 ms + 2ms
Calculation 1: 1000/240 = 25/6 = 4.16666
Calculation 2: 512 = 2^9 and 1000 = 2^10 (cancel using it) => it ends with 1/200 = .005
Disk access time = 8ms + 4.166666ms + 0.005ms + 2ms = 14.17ms
Comments
Post a Comment