ArticleslgStudy

computer science

Two-level scheduling

Two-level scheduling is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Two-level scheduling rather than just read about it. In short: Two-level scheduling is a computer science term to describe a method to more efficiently perform process scheduling that involves swapped out processes. Consider this problem: A system contains 50 running processes all with equal priority.

Key takeaways

  • Two-level scheduling belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Two-level scheduling to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Two-level scheduling from memory before moving on to harder problems.

Reference excerpt

Two-level scheduling is a computer science term to describe a method to more efficiently perform process scheduling that involves swapped out processes. Consider this problem: A system contains 50 running processes all with equal priority. However, the system's memory can only hold 10 processes in memory simultaneously. Therefore, there will always be 40 processes swapped out written on virtual memory on the hard disk. The time taken to swap out and swap in a process is 50 ms respectively. With straightforward Round-robin scheduling, every time a context switch occurs, a process would need to be swapped in (because only the 10 least recently used processes are swapped in). Choosing randomly among the processes would diminish the probability to 80% (40/50). If that occurs, then obviously a process also need to be swapped out. Swapping in and out of is costly, and the scheduler would waste much of its time doing unneeded swaps. That is where two-level scheduling enters the picture. It uses two different schedulers, one lower-level scheduler which can only select among those processes in memory to run. That scheduler could be a Round-robin scheduler. The other scheduler is the higher-level scheduler whose only concern is to swap in and swap out processes from memory. It does its scheduling much less often than the lower-level scheduler since swapping takes so much time. Thus, the higher-level scheduler selects among those processes in memory that have run for a long time and swaps them out. They are replaced with processes on disk that have not run for a long time. Exactly how it selects processes is up to the implementation of the higher-level scheduler. A compromise has to be made involving the following variables:

Response time: A process should not be swapped out for too long. Then some other process (or the user) will have to wait needlessly long. If this variable is not considered resource starvation may occur and a process may not complete at all. Size of the process: Larger processes must be subject to fewer swaps than smaller ones because they take longer time to swap. Because they are larger, fewer processes can share the memory with the process. Priority: The higher the priority of the process, the longer it should stay in memory so that it completes faster.

References Tanenbaum, Albert Woodhull, Operating Systems: Design and Implementation, p.92

Worked examples

Example 1 — a first encounter with Two-level scheduling

Start with the simplest possible case. Write down what Two-level scheduling claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Two-level scheduling before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Two-level scheduling ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Two-level scheduling

In research
Two-level scheduling appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Two-level scheduling in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Two-level scheduling is common in secondary-school and first-year university syllabi. It links to neighbouring topics Computer science stubs, Processor scheduling algorithms, so understanding it makes those chapters shorter.
In everyday life
Look for Two-level scheduling outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Two-level scheduling” →

How to study Two-level scheduling in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Two-level scheduling means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Two-level scheduling out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Two-level scheduling in simple terms?

Two-level scheduling is a computer science term to describe a method to more efficiently perform process scheduling that involves swapped out processes. Consider this problem: A system contains 50 running processes all with equal priority.

Why does Two-level scheduling matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Two-level scheduling?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Two-level scheduling.

Tags

  • Computer science stubs
  • Processor scheduling algorithms

Keep exploring