Skip to content
Think & Reflect · Q1

Q.In the web-server example (for result declaration), suppose the server receives a request from an Administrator to access the result of a school on an urgent basis, along with other requests from students to check individual results. Can you suggest some strategy to ensure service to all as per their urgency?

Karnataka PUCTextbookSubjective· 3mImportance★★★★★est
93% · 13/14 Questions
🔒 Locked · start free trial →

You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.

Start your 14-day free trial to unlock the full solution →

Priority Scheduling can be used to serve the Administrator's urgent request before the students' normal requests, ensuring fairness and urgency-based service.

This is a plain theory question that asks for a strategy to handle multiple requests with different urgency levels in a web-server scenario. The core idea is to use Priority Scheduling, where each request is assigned a priority level, and the server processes higher-priority requests first.

Why Priority Scheduling?

In a real-world web server handling result declarations, requests come from different users with varying needs. An Administrator's urgent request to access a school's result should be processed before a student's routine request to check their individual result. Without a prioritization mechanism, all requests would be treated equally, leading to delays for urgent tasks.

Priority Scheduling solves this by assigning a priority value to each request. The server then processes requests in order of their priority — highest priority first. This ensures that urgent requests are served promptly while still eventually serving all other requests.

Suggested Strategy

1. Assign Priority Levels

  • Administrator requests: Priority 1 (highest)
  • Student requests: Priority 2 (normal)
  • Other requests (e.g., public information): Priority 3 (lowest)

2. Implement a Priority Queue

The server maintains a priority queue where each request is enqueued with its priority. The scheduler always dequeues the request with the highest priority.

3. Use Preemptive or Non-Preemptive Scheduling

  • Non-preemptive: Once a request starts processing, it runs to completion. This is simpler but may cause a high-priority request to wait if a low-priority one is already being served.
  • Preemptive: If a higher-priority request arrives while a lower-priority one is being processed, the server pauses the lower-priority request and serves the higher-priority one first. This is more responsive but complex to implement.

For this scenario, non-preemptive priority scheduling is usually sufficient because the requests are short (fetching a result from a database). The Administrator's request will be queued with high priority and served before any pending student requests.

4. Handle Starvation

A risk with priority scheduling is that low-priority requests may never get served if high-priority requests keep arriving. To prevent this, use aging — gradually increase the priority of waiting low-priority requests over time. For example, every 30 seconds, increase the priority of any waiting student request by 1, so it eventually becomes high-priority. …

Unlock everything free for 14 days

  • Full step-by-step solutions
  • Concept-first explanations
  • Methods, shortcuts & mistakes
  • PYQ mapping + timed mock tests

Full access for 14 days. No credit card required.