scheduling

How does the OS scheduler regain control of CPU?

风格不统一 提交于 2019-11-30 06:13:05
问题 I recently started to learn how the CPU and the operating system works, and I am bit confused about the operation of a single-CPU machine with an operating system that provides multitasking. As such, supposing my machine has a single CPU, this would mean that, at any given time, only one process could be running. Now, I can only assume that the scheduler used by the operating system to control the access to the precious CPU time is also a process. Thus, in this machine, either the user

How to scale the Quartz scheduler?

主宰稳场 提交于 2019-11-30 05:10:56
I plan to use the Quartz scheduler as I read many good opinions about it. My problem is as follows: I will have thousands of triggers living in the system at any given time. Most of the triggers will fire just one event and die. In addition, it is very likely I will have to cancel many jobs after their allocation (based on new input). Can Quartz scale to this? Which JobStore is recommended? I planned to use the JDBC one over mysql. Added Information : My jobs will either send an e-mail or post data via HTTP post to other services (over WAN). There are some tips and recommendations in the FAQ:

Finding Last Fired time using a Cron Expression in Java

不羁的心 提交于 2019-11-30 03:46:41
问题 Is there a way in Java to find the "Last Fired Time" from a Cron Expression. E.g. If now = 25-Apr-2010 10pm, cron expression "0 15 10 ? * *" (quartz) should return me 25-Apr-2010 10:15am Note: 1) I do not care if we use standard cron expressions (like Unix and Quartz) or less popular ones if they can fetch me the correct "Last Fired Time" 2) Also it is not literally "Last Fire time" as the trigger may not have fired, but logically there should be a way of telling when it (would have) fired

Pros and cons of using java.util.timer vs Quartz for scheduling? [closed]

偶尔善良 提交于 2019-11-30 02:26:01
I've got to write an app that performs a series of tasks: task to be run once at 0200 hours every day. task to be run once at 0400 hours ever day task to be run at 15 minute intervals starting at 0003 hours task to be run at 15 minute intervals starting at 0005 hours What are the pros and cons of using plain java.util.timer Vs. Quartz for this? Are there any other alternatives I should be considering? Quartz Additional dependency API currently (late 2011) changing: 1.x on its way out, but the only one supported by Spring and possibly others Jobs can be stored persistently; multiple Schedulers

What is the best way to schedule a sending-email task with Ruby on Rails?

社会主义新天地 提交于 2019-11-30 02:22:14
I would like to schedule a daily task : every day at 7 AM, I want an email to be sent (without human intervention). I'm working on the RoR framework and I'm wondering what is the best way to do that? I've heard about BackgrounDRB, OpenWFEru scheduler or things based on Cron, but I'm a newbie and don't understand which one is made for my need. erik Another option is to create a rake task that is run by a cron job. To do this, create a file some_file.rake and put it in your lib/tasks folder. Your file might look like this: Rails 2.x: task :send_daily_mail, :needs => :environment do Model.send

Azure Task Scheduler

本秂侑毒 提交于 2019-11-30 00:17:42
While this question is particular to Azure, I'm sure that it is a common situation for cloud computing in general. I have a list of tasks that I need run at a certain time. With a window's server, I can use Task Scheduler and schedule my program to run at a certain time. I could go a step further and create a windows service that would run at a given interval and then execute the appropriate task. Does anyone have a suggestion on the best approach is for a cloud computing environment? I could create a worker role that polls the task list every second and then throws the appropriate task into a

Why one non-voluntary context switch per second?

删除回忆录丶 提交于 2019-11-29 19:59:36
问题 The OS is RHEL 6 (2.6.32). I have isolated a core and am running a compute intensive thread on it. /proc/{thread-id}/status shows one non-voluntary context switch every second. The thread in question is a SCHED_NORMAL thread and I don't want to change this. How can I reduce this number of non-voluntary context switches? Does this depend on any scheduling parameters in /proc/sys/kernel? EDIT : Several responses suggest alternative approaches. Before going that route, I first want to understand

A priority queue which allows efficient priority update?

喜你入骨 提交于 2019-11-29 19:59:24
UPDATE : Here's my implementation of Hashed Timing Wheels . Please let me know if you have an idea to improve the performance and concurrency. (20-Jan-2009) // Sample usage: public static void main(String[] args) throws Exception { Timer timer = new HashedWheelTimer(); for (int i = 0; i < 100000; i ++) { timer.newTimeout(new TimerTask() { public void run(Timeout timeout) throws Exception { // Extend another second. timeout.extend(); } }, 1000, TimeUnit.MILLISECONDS); } } UPDATE : I solved this problem by using Hierarchical and Hashed Timing Wheels . (19-Jan-2009) I'm trying to implement a

How to cancel Spring timer execution

Deadly 提交于 2019-11-29 18:55:28
问题 I need to cancel Spring timer execution or at least change the execution frequency based on some conditions. Was using both org.springframework.scheduling.quartz.SimpleTriggerBean and org.springframework.scheduling.timer.ScheduledTimerTask . Cannot find the way how to do it. 回答1: NOTE : This is for Spring 3.0+ Read Spring documentation on scheduling tasks Use a TaskScheduler service, such as a TimerManagerTaskScheduler or ThreadPoolTaskScheduler . Schedule your task by calling some

Triggering a Java program based on database updates and time interval

两盒软妹~` 提交于 2019-11-29 16:44:58
I want a mechanism that will start a java program ( quite a big one ) depending on 2 conditions: N new inserts in a MySQL table Every 5 minutes interval. I know that I can do this through crontab or using Timer or using Stored Procedure etc. My plan is to write a Java class ( I am most familiar with ), Listener having two threads in parallel - Database Listener and Time listener threads each of them monitoring one of these conditions. If one says, yes, the parent class will start a new thread to run the Program. I feel that it will be a heavy weight program. Is there some other option that I