scheduling

Class Scheduling algorithm to show best match with criteria?

廉价感情. 提交于 2019-12-03 20:31:45
I am looking to create a system where you can input the courses (3-7 courses) that you want to take at a college and then select preferences (Morning, Day, Evening, Night / M, T, W, TR, F). I need a way so that when the program queries the database (MySQL) it returns the best possible schedule that was made according to those parameters. I am writing it in php. Does any one know the best way to do this? Or a link to some sample code I could understand it from? It's NP-complete. If you want something simple and fast, write a construction heuristic like First Fit Decreasing . Simply put, it

scheduling a job every minute Rails 3.1 on Heroku

与世无争的帅哥 提交于 2019-12-03 19:32:52
问题 I want to run a task every minute on Heroku to check if conditions are met to time-out certain user tasks. I can only run a Heroku cron job every hour, so what's the best way to set up a timed task like this. I am using Rails 3.1 on Heroku. 回答1: You could use delayed_job with a self-restarting job with a :run_at . Something sort of like this: class YourJob def do_interesting_things #... Do what needs to be done. self.delay(:run_at => 1.minute.from_now).do_interesting_things end def self.start

Who schedules the scheduler in OS - Isn't it a chicken and egg scenario?

喜欢而已 提交于 2019-12-03 19:14:54
问题 Who schedules the scheduler? Which is the first task created and how is this first task created? Isn't any resource or memory required for it? isn't like a chicken and egg scenario? Isn't scheduler a task? Does it get the CPU at the end of each time slice to check which task needs to be given CPU? Are there any good links which makes a person think and understand deeply all these concepts rather than spilling out some theory which needs to be byhearted? 回答1: The scheduler is scheduled by an

How do I start a .NET process with idle priority?

别等时光非礼了梦想. 提交于 2019-12-03 18:10:20
问题 I'm using System.Diagnostics.ProcessStartInfo to set up the parameters for launching a process from a .NET program. Once the the process is started, I can use myProcess.PriorityClass = ProcessPriorityClass.Idle To change the priority for the process to idle, so that it only runs in the background, and doesn't hog my CPU power. Is there any way using the ProcessStartInfo object to specify that the process should start with an "Idle" priority, so that at no time during execution is the process

Scheduling Algorithm for Maintining Two Dimensional Constraint

社会主义新天地 提交于 2019-12-03 16:44:33
I have been tasked to do a scheduling program in my company. Basically given N employee you should schedule them shift for the month. I tried to do this via brute force and ordered priority of constraint. However, I am having problem when trying to maintain vertical and horizontal constraints. Vertical constraints, all person should have equal number of shift per month. (e.g. They should be within the average number of day shift, night shift, rest day, early shift) However, there is also a day horizontal constraint that the number of shift per day should be equal daily. I tried searching the

SCHED_FIFO process with priority of 99 gets preempted?

自闭症网瘾萝莉.ら 提交于 2019-12-03 16:12:22
this is from sched_setscheduler(2) - Linux man page: "Processes scheduled under one of the real-time policies (SCHED_FIFO, SCHED_RR) have a sched_priority value in the range 1 (low) to 99 (high)." "A SCHED_FIFO process runs until either it is blocked by an I/O request, it is preempted by a higher priority process, or it calls sched_yield(2)." I have the following code: struct sched_param sp; memset( &sp, 0, sizeof(sp) ); sp.sched_priority = 99; sched_setscheduler( 0, SCHED_FIFO, &sp ); Now the process should be running under the highest possible priority (99) and should never be preempted. So,

How to schedule Java Threads

杀马特。学长 韩版系。学妹 提交于 2019-12-03 15:51:00
I have read that Java threads are user-level threads and one of the differences between user level threads and kernel level threads is that kernel level threads are scheduled by the kernel(we cannot change it) where as for user level threads we can define our own scheduling algorithm. So how do we schedule threads in Java? At any given time, when multiple threads are ready to be executed, the runtime system chooses the Runnable thread with the highest priority for execution. If two threads of the same priority are waiting for the CPU, the scheduler chooses one of them to run in a round-robin

Java library class to handle scheduled execution of “callbacks”?

痞子三分冷 提交于 2019-12-03 13:45:23
My program has a component - dubbed the Scheduler - that lets other components register points in time at which they want to be called back. This should work much like the Unix cron service, i. e. you tell the Scheduler "notify me at ten minutes past every full hour". I realize there are no real callbacks in Java. Here's my approach, is there a library which already does this stuff? Feel free to suggest improvements, too. Register call to Scheduler passes: a time specification containing hour, minute, second, year month, dom, dow, where each item may be unspecified, meaning "execute it every

Constantly monitor a program/process using Python

与世无争的帅哥 提交于 2019-12-03 12:59:18
I am trying to constantly monitor a process which is basically a Python program. If the program stops, then I have to start the program again. I am using another Python program to do so. For example, say I have to constantly run a process called run_constantly.py . I initially run this program manually, which writes its process ID to the file "PID" (in the location out/PROCESSID/PID). Now I run another program which has the following code to monitor the program run_constantly.py from a Linux environment: def Monitor_Periodic_Process(): TIMER_RUNIN = 1800 foo = imp.load_source("Run_Module","run

Is Work Stealing always the most appropriate user-level thread scheduling algorithm?

痞子三分冷 提交于 2019-12-03 12:04:15
I've been investigating different scheduling algorithms for a thread pool I am implementing. Due to the nature of the problem I am solving I can assume that the tasks being run in parallel are independent and do not spawn any new tasks. The tasks can be of varying sizes. I went immediately for the most popular scheduling algorithm "work stealing" using lock-free deques for the local job queues, and I am relatively happy with this approach. However I'm wondering whether there are any common cases where work-stealing is not the best approach. For this particular problem I have a good estimate of