Advantages and disadvantages with Static- and Dynamic Scheduling

In simple terms,

Static Scheduling is the mechanism, where we have already controlled the order/way that the threads/processes are executing in our code (Compile time). If you have used any control(locks, semaphores, joins, sleeps) over threads in your program (to achieve some goal), then you have intended to use static (compile time) scheduling.

Dynamic Scheduling is the mechanism where thread scheduling is done by the operating systems based on any scheduling algorithm implemented in OS level. So the execution order of threads will be completely dependent on that algorithm, unless we have put some control on it (with static scheduling).

I think the term 'advantages' would not be the best term here. Simply when you are implementing any control over threads with your code to achieve some task, you should make sure that you have used minimal controls and also in most optimized way. :))

Addition:

Comparison between Static & Dynamic Scheduling

Generally we would never have a computer program which would completely depend on only one of Static or Dynamic Scheduling.

Instead we would have some programs which are pretty much in controlled from the code itself (Strongly static). This would be a good example for that.

And some programs would be strongly dynamic (weakly static). This would be a good example for that. There you might see other than the start of 2 threads, rest of the program execution would be a free flyer.

Please don't try to find a disclaimer criteria which would seal a program either a strongly static or strongly dynamic one. :))

Positives & Negatives

  • Dynamic Scheduling scheduling is faster in execution than static scheduling, since it's basically a free flyer without any intentional waits, joins etc. (any kind of synchronization/protection between threads).

  • Dynamic Scheduling is not aware of any thread dependencies (safeness, synchronization etc.). If you followed above sources I mentioned, you would probably have the idea.

  • So generally, how good multi-threading programmer you are, would depend on how limited restrictions, dependencies, bottlenecks you have implemented on your threads yet to achieve your task successfully. :))

I think I have covered quite a things. Please raise me questions if any. :))