scheduling

force scheduler to allocate thread to specific processor

白昼怎懂夜的黑 提交于 2019-12-04 15:23:27
Consider a case where we have multiple processor/cores and two threads. Is it possible to force the linux scheduler to always schedule the specific thread(both) to a specific processor at every instance of its execution. Is setting processor affinity to the threads, while creation, sufficient for this purpose If you look at the man page for taskset you can see the following statement: The Linux scheduler will honor the given CPU affinity and the process will not run on any other CPUs. This means that setting the CPU affinity for a particular process will make sure that it's always run on that

pthreads with real time priority

五迷三道 提交于 2019-12-04 12:20:06
问题 I need to manage a pool of threads having different priorities, so I wrote the following thread startup procedure: static int startup(thrd_t *thrd, thrd_sync_t *sync, int prio) { pthread_attr_t attr; int err; struct sched_param param = { .sched_priority = prio }; assert(pthread_attr_init(&attr) == 0); assert(pthread_attr_setschedpolicy(&attr, SCHED_FIFO) == 0); assert(pthread_attr_setschedparam(&attr, &param) == 0); err = pthread_create(&thrd->handler, &attr, thread_routine, (void *)thrd);

Disk cylinder service requests algorithms

☆樱花仙子☆ 提交于 2019-12-04 12:01:16
Suppose that a disk drive has 5000 cylinders, numbered 0 to 4999. The drive is currently serving a request at cylinder 143, and the previous request was at cylinder 125. The queue of pending requests, in FIFO order, is 86, 1470, 913, 1774, 948, 1509, 1022, 1750, 130 Starting from the current head position, what is the total distance (in cylinders) that the disk arm moves to satisfy all the pending requests, for each of the following disk-scheduling algorithms --> C-SCAN and C-LOOK I have made some notes on what I think the order in each case would be and the resulting distance. a. Starts at

Algorithm to find middle of largest free time slot in period?

这一生的挚爱 提交于 2019-12-04 11:17:07
Say I want to schedule a collection of events in the period 00:00–00:59. I schedule them on full minutes (00:01, never 00:01:30). I want to space them out as far apart as possible within that period, but I don't know in advance how many events I will have total within that hour. I may schedule one event today, then two more tomorrow. I have the obvious algorithm in my head, and I can think of brute-force ways to implement it, but I'm sure someone knows a nicer way. I'd prefer Ruby or something I can translate to Ruby, but I'll take what I can get. So the algorithm I can think of in my head:

Does any JVM implement blocking with spin-waiting?

烂漫一生 提交于 2019-12-04 09:21:12
In Java Concurrency in Practice, the authors write: When locking is contended, the losing thread(s) must block. The JVM can implement blocking either via spin-waiting (repeatedly trying to acquire the lock until it succeeds) or by suspending the blocked thread through the operating system. Which is more efficient depends on the relationship between context switch overhead and the time until the lock becomes available; spin-waiting is preferred for short waits and suspension is preferable for long waits. Some JVMs choose between the two adaptively based on profiling data of past wait times, but

When are lock free data structures less performant than mutual exclusion (mutexes)?

大兔子大兔子 提交于 2019-12-04 07:44:22
问题 I read somewhere (can't find the page anymore) that lock free data structures are more efficient "for certain workloads" which seems to imply that sometimes they're actually slower or the gain from them can be zero in some situations. Taking the ~100 cycle hit of a lock instruction to do an atomic op sounds plenty faster to me than going to sleep and waiting for the scheduler to wake the process back up, so it's not obvious to me under what circumstances a lock free data structure would be

Teacher time schedule algorithm

╄→尐↘猪︶ㄣ 提交于 2019-12-04 07:29:27
问题 This is a problem I've had on my mind for a long time. Being the son of a teacher and a programmer, it occurred to me early on... but I still haven't found a solution for it. So this is the problem. One needs to create a time schedule for a school, using some constraints. These are generally divided in two categories: Sanity Checks A teacher cannot teach two classes at the same time A student cannot follow two lessons at the same time Some teachers must have at least one day off during the

High School Timetable using a Genetic Algorithm

梦想的初衷 提交于 2019-12-04 06:14:31
问题 I'm making a high school timetable genetic algorithm in java as a project, but I have couple questions in what direction I can approach this in. What should be my chromosome encoding? An ArrayList that holds each value or perhaps a string? How should I input and output the data? Should I hold the data in a excel and output the timetable as a GUI? Is there any essential knowledge a novice programmer should keep in mind when implementing the algorithm? So far the experience I've had with GA's

Replacing Celerybeat with Chronos

风格不统一 提交于 2019-12-04 03:29:26
How mature is Chronos ? Is it a viable alternative to scheduler like celery-beat? Right now our scheduling implements a periodic "heartbeat" task that checks of "outstanding" events and fires them if they are overdue. We are using python-dateutil 's rrule for defining this. We are looking at alternatives to this approach, and Chronos seems a very attactive alternative: 1) it would mitigate the necessity to use a heartbeat schedule task, 2) it supports RESTful submission of events with ISO8601 format, 3) has a useful interface for management, and 4) it scales. The crucial requirement is that

How to schedule Pentaho Kettle transformations?

旧街凉风 提交于 2019-12-03 21:42:08
I've set up four transformations in Kettle. Now, I would like to schedule them so that they will run daily at a certain time and one after the another. For example, tranformation1 -> transformation2 -> transformation3 -> transformation4 should run daily at 8.00 am. How can I do that? You can execute transformation from the command line using the tool Pan : Pan.bat /file:transform.ktr /param:name=value The syntax might be different depending on your system - check out the link above for more information. When you have a batch file executing your transformation you can just schedule it to run