As I stated in my question, queue_delayed_work just uses add_timer internally. So the use is equally.
Linux Kernel Labs
linux-kernel-labs.github.io › refs › heads › master › labs › deferred_work.html
Deferred work — The Linux Kernel documentation
The time unit for the delay is jiffies. To wait for all work items to finish call flush_workqueue(): void flush_workqueue(struct worksqueue_struct * queue);
C-pointers
c-pointers.com › LinuxDeviceDriver › basic_ldd › chapter4_workqueue › p8_Workqueue_queue_delayed_work.html
Workqueue : queue_delayed_work - C Pointers Tutorials
... Initialize the variables and APIs which is used in this program. ... static int __init queue_init(void) { INIT_DELAYED_WORK(&d_work, workqueue_func); queue_delayed_work(system_wq, &d_work, msecs_to_jiffies(TIMEOUT)); pr_info("Driver Loaded\n"); return 0; }
Top answer 1 of 3
3
As I stated in my question, queue_delayed_work just uses add_timer internally. So the use is equally.
2 of 3
3
In case of kernel programming, when your callback function for timer/work needs to sleep then you have to use delayed_work. As delayed_work runs in process context you can use those function which may sleep or tends to sleep inside callback function. While in case of kernel timer you can not use those function which sleeps or tends to sleep. Conclusion: if your call back function needs sleeping use work queues else use timers/tasklets.
Hope it helps :)
LWN.net
lwn.net › Articles › 731052
Power-efficient workqueues [LWN.net]
foo_init() allocates the delayed work structure and queues it with a ten-jiffy delay.
GitHub
github.com › collectiveidea › delayed_job
GitHub - collectiveidea/delayed_job: Database based asynchronous priority queue system -- Extracted from Shopify · GitHub
Rails 4: replace script/delayed_job with bin/delayed_job · Workers can be running on any computer, as long as they have access to the database and their clock is in sync. Keep in mind that each worker will check the database at least every 5 seconds. You can also invoke rake jobs:work which will start working off jobs. You can cancel the rake task with CTRL-C. If you want to just run all available jobs and exit you can use rake jobs:workoff · Work off queues by setting the QUEUE or QUEUES environment variable.
Starred by 4.8K users
Forked by 946 users
Languages Ruby
Linux Kernel
docs.kernel.org › core-api › workqueue.html
Workqueue — The Linux Kernel documentation
If the desired behavior is queueing only if certain events took place while work is disabled, the user should implement the necessary state tracking and perform explicit conditional queueing after enable_work(). bool schedule_delayed_work_on(int cpu, struct delayed_work *dwork, unsigned long delay)¶
Linux Manual Page
linux.die.net › lkmpg › x1211.html
Scheduling Tasks
The way we do this is we create a task, held in a workqueue_struct structure, which will hold a pointer to the function. Then, we use queue_delayed_work to put that task on a task list called my_workqueue, which is the list of tasks to be executed on the next timer interrupt.
GitHub
gist.github.com › yagihiro › 309746
workqueue sample on linux kernel · GitHub
Don't forget to cancel the possible work in the queue (cancel_delayed_work_sync) when you close the workqueue, otherwise your kernel will crash. ... You are a lifesaver, arxchruncher, I had spent an hour trying to figure out why my kernel crashed. ... Here is a minimal working example using cancel_work_sync https://github.com/cirosantilli/linux-kernel-module-cheat/blob/ad077d3943f79c0f6481dab929970613c33c31a7/kernel_module/workqueue_cheat.c
Huihoo
docs.huihoo.com › linux › kernel › 2.6.26 › kernel-api › re63.html
queue_delayed_work
queue_delayed_work — queue work on a workqueue after delay
HackMD
hackmd.io › @TomasZheng › B1hxDlA57
[Note] A glimpse of Workqueue in Linux - HackMD
// //Specific workqueues operation to enqueue work on a work queue // #define create_workqueue(name) \ alloc_workqueue("%s", __WQ_LEGACY | WQ_MEM_RECLAIM, 1, (name)) static inline bool queue_work (struct workqueue_struct *wq, struct work_struct *work); static inline bool queue_delayed_work (struct workqueue_struct *wq, struct delayed_work *dwork, unsigned long delay); extern bool queue_work_on(int cpu, struct workqueue_struct *wq, struct work_struct *work); extern bool queue_delayed_work_on (int cpu, struct workqueue_struct *wq, struct delayed_work *work, unsigned long delay); extern void flus
Debian Manpages
manpages.debian.org › testing › linux-manual-4.8 › queue_delayed_work.9.en.html
queue_delayed_work(9) — linux-manual-4.8 — Debian testing — Debian Manpages
bool queue_delayed_work(struct workqueue_struct * wq, struct delayed_work * dwork, unsigned long delay);
Zephyr Project
docs.zephyrproject.org › latest › kernel › services › threads › workqueue.html
Workqueue Threads — Zephyr Project Documentation
An example is collecting data that comes in asynchronously, e.g. characters from a UART associated with a keyboard. There are two APIs that submit work after a delay: k_work_schedule() (or k_work_schedule_for_queue()) schedules work to be executed at a specific time or after a delay.
AWS
docs.aws.amazon.com › amazon simple queue service › developer guide › amazon sqs features and capabilities › amazon sqs delay queues
Amazon SQS delay queues - Amazon Simple Queue Service
To set delay seconds on individual ... delay queue's DelaySeconds value. EventBridge Scheduler also supports scheduling individual messages. ... Thanks for letting us know we're doing a good job! If you've got a moment, please tell us what we did right so we can do more of it. ... Thanks for letting us know this page needs work...
OneUptime
oneuptime.com › home › blog › how to implement delay queues in sqs
How to Implement Delay Queues in SQS
February 2, 2026 - Args: queue_url: FIFO queue URL message_body: Message content message_group_id: Group ID for ordering (messages in same group are ordered) deduplication_id: Optional dedup ID (auto-generated if content-based dedup enabled) Returns: SendMessage response """ params = { 'QueueUrl': queue_url, 'MessageBody': json.dumps(message_body), 'MessageGroupId': message_group_id, } # Add deduplication ID if not using content-based deduplication if deduplication_id: params['MessageDeduplicationId'] = deduplication_id response = sqs.send_message(**params) print(f"FIFO message sent to group '{message_group_id}'
EmbeTronicX
embetronicx.com › tutorials › linux › device-drivers › workqueue-in-linux-kernel
Workqueue in Linux Kernel Part 1 – Linux Device Driver Tutorial Part 14
September 24, 2023 - A call to cancel_work_sync will terminate the work in the queue or block until the callback has finished (if the work is already in progress in the handler). If the work is delayed, you can use a call to cancel_delayed_work_sync. ... Finally, you can find out whether a work item is pending (not yet executed by the handler) with a call to work_pending or delayed_work_pending. ... I took the source code from the previous interrupt example tutorial.
Rahul Bhati
therahulbhati.github.io › posts › delay queues: do it later, reliably
Delay Queues: Do It Later, Reliably | Rahul Bhati
October 21, 2025 - Rate smoothing — spread out work to avoid thundering herds. Built-in support for delayed messages in brokers. ... Use a Redis sorted set with score = execution timestamp. Fast lookups; easy cancel/reschedule. ... # Schedule a job ZADD delays <execution_timestamp> <job_id> # Fetch due jobs (batch of 100) ZRANGEBYSCORE delays -inf <now> LIMIT 0 100 # Remove once picked up ZREM delays <job_id>