in Operating System closed by
6,888 views
1 vote
1 vote
closed with the note: clear to me
Paging increases context switch time how and why ???
in Operating System closed by
6.9k views

1 comment

The operating system must keep track of each individual process's page table, updating it whenever the process's pages get moved in and out of memory, and applying the correct page table when processing system calls for a particular process. This all increases the overhead involved when swapping processes in and out of the CPU. ( The currently active page table must be updated to reflect the process that is currently running. )

refference:- https://www.cs.uic.edu/~jbell/CourseNotes/OperatingSystems/8_MainMemory.html

1
1

2 Answers

2 votes
2 votes

Context Switch basically means, taking CPU from one process and giving it to another process (which is in the ready queue and hence already loaded into memory).

Paging is way to manage memory efficiently by bringing into memory those part of the program which is required and keeping the rest of the disk and bring them as per need. Pages of other processes, which were brought into memory earlier might be evicted to make space for new processes.

So in the current situation, during a context switch, the new processes might find that most of its pages have been evicted, which needs to be brought back, which will take time, and hence the time to context switch is increased.

Imagine if there were no paging, then the whole program has to be kept into the memory and during a context switch, the new process will always find its all "parts (pages)" in the memory and hence, this will be very fast but very very very un efficient use of the memory, as we have to keep everything in the memory even if it is not required as of now.

Hope this helps. Please let me know if there are any doubts.

See this answer:

https://stackoverflow.com/a/54057079/2858560

edited by

3 Comments

This is not correct. You have explained swapping and not context switch.
1
1
u explain swapping more compare to context swtich but ans is within the lines
0
0
can you please explain the correct answer
0
0
0 votes
0 votes
In older OS, user PT(page table) was kept in secondary memory. Whenever context switch took place an hardware PT implemented using registers had to be loaded with user PT. This loading requires time thus making context switch longer for systems using paging.

In new OS which have large size PT, the PT (user PT) is being kept in main memory thus no need to load into registers( so no hardware PT).

Related questions