scheduling

Run a program or method at specific time in Java

天涯浪子 提交于 2019-11-29 16:26:38
I just want that my program or method should run at specific date and time. i have heard about Timer and TimerTask in java API. But don't know exactly how to use it. If you want to run a java program at a specific time you probably want to look at the OS tools (like cron or at). If you want to run a method inside of an already running java application then the ScheduleExecutorService , while it may be overkill, is pretty easy to use. If this is for your own benefit and not for a project I would suggest you look into http://java.sun.com/javase/6/docs/api/java/util/concurrent

Class Scheduling to Boolean satisfiability [Polynomial-time reduction] Final Part

你说的曾经没有我的故事 提交于 2019-11-29 16:14:07
I'm working since few weeks now on a project really interesting but unfortunately with a very complex background. I already asked 3 questions : Class Scheduling to Boolean satisfiability [Polynomial-time reduction] Final Part (here) Class Scheduling to Boolean satisfiability [Polynomial-time reduction] part 2 Class Scheduling to Boolean satisfiability [Polynomial-time reduction] in both of them, I get my answer (thank you again @Amit) but now arrived the final part, who will make this project useable :) I for now can manage : N time-intervals. C courses. T teachers. S rooms. My constraints are

Concurrent execution of scheduled tasks in Java

岁酱吖の 提交于 2019-11-29 15:17:27
I have a TimerTask that is designed to gather metrics at a specific interval. However it is possible that the period of the task execution is less than the time of task execution (occasionally if something times out and gets delayed). Is there a way to execute multiple TimerTasks or Runnables, threads, etc. concurrently without waiting for the previous task to complete? I know that Timer uses a single thread, and the ScheduledThreadPoolExecutor will delay execution regardless of the rate. Thanks. I would recommend you using Executors.newCachedThreadPool() or newCachedThreadPool(ThreadFactory

Hungarian Algorithm and multiple factors

心不动则不痛 提交于 2019-11-29 15:14:50
问题 I have a situation where I need to allocate people to several events. If we just had a price as a factor, it would be fine, but there is a number of factors that come in. First, some background. This is for a non-profit organization that promotes story hours for children that are hospitalized for any reason, so they depend on voluntary work to do so. So, since they rely on people's good will, they give people as much work as people can / want to do, which varies like: Some people can only do

Niceness and priority processes on Linux system

可紊 提交于 2019-11-29 11:10:48
问题 I am looking for a way to modify a process' priority through command line. I found the builtin (bash) nice and the command renice which allow to modify the niceness of the process, but not the actual priority which is calculated by the kernel. Is there a command which allows to set the priority? (Or am I confused between niceness and priority?) 回答1: The priority of a process in linux is dynamic: The longer it runs, the lower its priority will be. A process runs when its actually using the CPU

Concurrency of posix threads in multiprocessor machine

人走茶凉 提交于 2019-11-29 11:04:50
I have some doubts regarding concurrency of posix threads in multiprocessor machine. I have found similar questions in SO regarding it but didnt find conclusive answer. Below is my understanding. I want to know if i am correct. Posix threads are user level threads and kernel is not aware of it. Kernel scheduler will treat Process( with all its threads) as one entity for scheduling. It is the thread library that in turn chooses which thread to run. It can slice the cpu time given by the kernel among the run-able threads. User threads can run on different cpu cores. ie Let threads T1 & T2 be

PHP function that receive a cron string and return the next run timestamp

大城市里の小女人 提交于 2019-11-29 09:20:42
I need to develop a task system that should be able to work on servers that doesn't support crontab. I'm asking if there is any existing code that can take a cron string (e.g. '0 0,12 1 */2 *' and return the timestamp of the next scheduled run. If such a code couldn't be found then how should I start with that? You could use this class PHP-Parse-cron-strings-and-compute-schedules It'll also compute the last scheduled run Use this function: function parse_crontab($time, $crontab) {$time=explode(' ', date('i G j n w', strtotime($time))); $crontab=explode(' ', $crontab); foreach ($crontab as $k=>

How do I schedule a task with Celery that runs on 1st of every month?

橙三吉。 提交于 2019-11-29 08:06:17
问题 How do I schedule a task with celery that runs on 1st of every month? 回答1: Since Celery 3.0 the crontab schedule now supports day_of_month and month_of_year arguments: http://docs.celeryproject.org/en/latest/userguide/periodic-tasks.html#crontab-schedules 回答2: You can do this using Crontab schedules and you cand define this either: in your django settings.py : from celery.schedules import crontab CELERYBEAT_SCHEDULE = { 'my_periodic_task': { 'task': 'my_app.tasks.my_periodic_task', 'schedule'

Scheduling php scripts

只愿长相守 提交于 2019-11-29 08:02:49
I want to create some function to schedule php scripts,for example if i want tu run page.php at 12/12/2012 12:12 i can call schedule_script('12/12/2012 12:12','page.php');//or by passing a time/datetime object or for example call one script every minute schedule_interval(60,'page.php');//every 60s=1minute i'll may add some other function to see what script are scheduled or delete one of them. i want this functions to work on both UNIX and WINDOWS platforms,i DO NOT want ugly solutions like executing a script on every page of the site(i want to schedule this commands when nobody is on the site)

Can I prevent a Linux user space pthread yielding in critical code?

北慕城南 提交于 2019-11-29 07:31:22
I am working on an user space app for an embedded Linux project using the 2.6.24.3 kernel. My app passes data between two file nodes by creating 2 pthreads that each sleep until a asynchronous IO operation completes at which point it wakes and runs a completion handler. The completion handlers need to keep track of how many transfers are pending and maintain a handful of linked lists that one thread will add to and the other will remove. // sleep here until events arrive or time out expires for(;;) { no_of_events = io_getevents(ctx, 1, num_events, events, &timeout); // Process each aio event