JobScheduler
A job scheduler to schedule M jobs on N threads
Install / Use
/learn @naresh-chaudhary/JobSchedulerREADME
JobScheduler
A job scheduler to schedule M jobs on N threads on a single machine. The input contains the following data:
- Job Name
- Duration: time taken for job completion
- Priority: priority of the job. P0>P1>P2
- Deadline: Expiry time after which job should not be run (The clock starts from 0 and deadline is the actual clock time)
- UserType: Type of user who has initiated the job, Precedence of users Root>Admin>User
There are various scheduling algorithms-
Shortest Job First - SJF
Shortes job first (SJF), is a scheduling policy that selects the waiting process with the smallest execution time to execute next. In case of tie choose the job according to the following order-
- Priority(higher priority job gets scheduled first)
First Come First Serve -FCFS
Jobs are executed on first come,first serve basis. Take the input as the order of jobs need to be scheduled.
Fixed Priority Scheduling -FPS
Each process is assigned a priority. Process with highest priority is to be executed first and so on. In case of tie choose the job according to the following order-
- User Type
- Longest Job First
Earliest Deadline First - EDF
Next job will be searched on the basis of job which is closest to its deadline. In case of tie, choose the job according to the following order-
- Priority(higher priority job gets scheduled first)
- Duration(lesser duration job gets scheduled first) In case we cannot schedule a job such that it completes before its deadline then it should be ignored.
You would be given a list of jobs (refer example below for format) and number of threads as input. You are expected to print the order of jobs scheduled for each algorithm on each thread as output.
Example
Input
Threads= 2
Job Name | Duration | Priority | Deadline | User Type ---------|---------|---------|---------|--------- J1 | 10 | P0 | 10 | Root J2 | 20 | P0 | 40 | Admin J3 | 15 | P2 | 40 | Root J4 | 30 | P1 | 40 | User J5 | 10 | P2 | 30 | User
Output
SJF
Thread 1 - J1, J3, J4
Thread 2 - J5, J2
FCFS
Thread 1 - J1, J3, J5
Thread 2 - J2, J4
FPS
Thread 1 - J1, J4, J5
Thread 2 - J2, J3
EDF
Thread 1 - J1, J2
Thread 3 - J5, J4
Related Skills
node-connect
347.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
108.0kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
347.2kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
347.2kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
