Compatible Timesharing System (CTSS) has a priority scheduler. A process initially gets 1 quanta of time, then 2 quanta, then 4 quanta, 8 quanta, 16 quanta, 32 quanta, and 64 quanta where quanta is the length of the time quantum. Between time quanta, the process is swapped out. Thus for a process that has a service time of 100, it would take 7 swaps to disk (including when it was loaded into memory for the first time). Suppose a process had a service time of 30, how many times must it be swapped in before it complete using the CTSS
When The Process has CTSS as 30
Lets See how many Times The Process is Swapped
1. It was loaded into memory for the first time so 1 Swap And run for Time Quantum 1
Remaining CTSS = 29
2.Now It gets swapped and run for time quantum 2
Remaining CTSS = 27
3. Again Swap and run for time quantum of 4
Remaining CTSS = 23
4 Again Swap and run for time quantum of 8
Remaining CTSS = 15
5. Swapped Last Time and run for time quantum of 15 only .
Remaining CTSS =0
Hence Total Number of Swaps = 5 ( including when it was loaded into memory for the first time).
This is how we can get the number of swaps for any process in given time quantums
Thank You
Do like the answer and have any doubt drop in comments
Get Answers For Free
Most questions answered within 1 hours.