Questions tagged [scheduling]

In computer science, scheduling is the method by which threads, processes or data flows are given access to system resource.

Source: "Scheduling (computing)" article on Wikipedia

Types of scheduling

  • Round-robin

    Processes are given a set amount of time. For more information see

  • First come first serve

    Processes are executed in the order of the queue.

  • Shortest job first

    Processes are executed in order of estimated time.

  • Shortest remaining time

    Similar to shortest job first; however, if a new, shorter process joins the queue, then the scheduler will switch to that one.

  • Multi-level feedback queue

    There is more than just one queue, each queue has a certain priority and the scheduler can move jobs between queues when necessary. Modern operating systems like Windows use this.

2772 questions
304
votes
6 answers

Java Timer vs ExecutorService?

I have code where I schedule a task using java.util.Timer. I was looking around and saw ExecutorService can do the same. So this question here, have you used Timer and ExecutorService to schedule tasks, what is the benefit of one using over…
kal
  • 28,545
  • 49
  • 129
  • 149
297
votes
15 answers

What is the Windows version of cron?

A Google search turned up software that performs the same functions as cron, but nothing built into Windows. I'm running Windows XP Professional, but advice for any version of Windows would be potentially helpful to someone. Is there also a way to…
Thomas Owens
  • 114,398
  • 98
  • 311
  • 431
183
votes
5 answers

What is an uninterruptible process?

Sometimes whenever I write a program in Linux and it crashes due to a bug of some sort, it will become an uninterruptible process and continue running forever until I restart my computer (even if I log out). My questions are: What causes a process…
Jason Baker
  • 192,085
  • 135
  • 376
  • 510
161
votes
11 answers

Is there a job scheduler library for node.js?

Is there some cron like library that would let me schedule some function to be ran at certain time (15:30 for example, not x hours from now etc)? If there isn't this kind of library how this should be implemented? Should I just set callback to be…
JtR
  • 20,568
  • 17
  • 46
  • 60
148
votes
5 answers

How to parameterize @Scheduled(fixedDelay) with Spring 3.0 expression language?

When using the Spring 3.0 capability to annotate a scheduled task, I would like to set the fixedDelay as parameter from my configuration file, instead of hard-wiring it into my task class, like currently... @Scheduled(fixedDelay = 5000) public void…
ngeek
  • 7,733
  • 11
  • 36
  • 42
88
votes
10 answers

How might I schedule a C# Windows Service to perform a task daily?

I have a service written in C# (.NET 1.1) and want it to perform some cleanup actions at midnight every night. I have to keep all code contained within the service, so what's the easiest way to accomplish this? Use of Thread.Sleep() and checking for…
ctrlalt3nd
  • 1,352
  • 3
  • 13
  • 18
88
votes
14 answers

How to instruct cron to execute a job every second week?

I would like to run a job through cron that will be executed every second Tuesday at given time of day. For every Tuesday is easy: 0 6 * * Tue But how to make it on "every second Tuesday" (or if you prefer - every second week)? I would not like to…
tkokoszka
  • 11,647
  • 10
  • 30
  • 25
86
votes
5 answers

Selecting a Linux I/O Scheduler

I read that it's supposedly possible to change the I/O scheduler for a particular device on a running kernel by writing to /sys/block/[disk]/queue/scheduler. For example I can see on my system: anon@anon:~$ cat /sys/block/sda/queue/scheduler noop…
Robert S. Barnes
  • 39,711
  • 30
  • 131
  • 179
74
votes
9 answers

ScheduledExecutorService Exception handling

I use ScheduledExecutorService to execute a method periodically. p-code: ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor(); ScheduledFuture handle = scheduler.scheduleWithFixedDelay(new Runnable() { …
卢声远 Shengyuan Lu
  • 31,208
  • 22
  • 85
  • 130
73
votes
5 answers

Whole one core dedicated to single process

Is there any way in Linux to assign one CPU core to a particular given process and there should not be any other processes or interrupt handlers to be scheduled on this core? I have read about process affinity in Linux Binding Processes to CPUs…
akp
  • 1,753
  • 3
  • 18
  • 26
72
votes
3 answers

How does the OS scheduler regain control of CPU?

I recently started to learn how the CPU and the operating system works, and I am a bit confused about the operation of a single-CPU machine with an operating system that provides multitasking. Supposing my machine has a single CPU, this would mean…
69
votes
7 answers

How to stop a Runnable scheduled for repeated execution after a certain number of executions

Situation I have a Runnable. I have a class that schedules this Runnable for execution using a ScheduledExecutorService with scheduleWithFixedDelay. Goal I want to alter this class to schedule the Runnable for fixed delay execution either…
Spycho
  • 7,698
  • 3
  • 34
  • 55
68
votes
5 answers

Java thread affinity

Does anybody know of a way to lock down individual threads within a Java process to specific CPU cores (on Linux)? I've done this in C, but can't find how to do this in Java. My instincts are that this will require a JNI call, but I was hoping…
Dave
  • 1,420
  • 3
  • 17
  • 25
64
votes
5 answers

Provide time zone to Spring @Scheduled?

How can I configure the time zone for a Spring based @Scheduled cron job? Background: I have a job that executes once a day, say 2 PM, using Spring's @Scheduled annotation: @Scheduled(cron = "0 0 14 * * *") public void execute() { // do…
matsev
  • 32,104
  • 16
  • 121
  • 156
63
votes
8 answers

Recommended method for loading a URL via a scheduled task on Windows

I have a webpage hosted on a Windows box that I need to assure gets loaded at least once/day. My current plan is to create a scheduled task that opens Internet Explorer and hits the URL: "C:\Program Files\Internet Explorer\iexplore.exe"…
Cory House
  • 14,235
  • 13
  • 70
  • 87
1
2 3
99 100