I don't know what IBM nor JCL (?) has to do with it, but the thing is
this:
on 16 bit windows (win3.xx), the scheduler worked with 16bit processes
only and basicly scheduled the processes/threads once the thread who had
the processor gave execution back to the scheduler. This is called
'co-operative' as multi-tasking was depending on the cooperation between
applications. I.e.: if an application didn't give execution back to the
scheduler, the system 'hanged' (no other threads got the CPU) unless a
non-maskable interrupt was triggered.
on 32bit windows based on the win95 kernel (win9x, winME) the scheduler
worked pre-emptively. This means that the whole system was divided in
32bit processes and the scheduler scheduled the threads of these processes
using a priority stack and some other protocols (mostly round-robin). Each
thread in the system was given a fixed amount of time, after that, the
scheduler simply took teh CPU away from the thread and the thread was
physically halted as another thread was given the CPU. It depended on the
priority/place in teh thread queue which thread was given the CPU. This is
totally different from the 16bit OS, as the scheduler decided which thread
was given the CPU, not the thread currently running.
16bit applications were all ran in a single 32bit process. 16bit processes
on 16bit windows shared the system memory so they all had access to
eachother memory and as they were all scheduled as 1 process, their
multitasking was still depending on co-operation, as the whole 16bit
process space was given the CPU, inside it it was then decided which
process got the CPU, i.e.: the last process which had the CPU.
On 32bit windows based on the NT kernel, this is not that different,
except from teh fact that 16bit processes are run inside a virtual
machine.
Co-operative multi-tasking is stupid. It easily hangs the machine.
(win9x/ME also had problems with 16bit processes which stepped on its own
16bit OS libraries (as they all shared the same memory), for example parts
of the shell were 16bit code, so a bad 16bit program could hang the
complete system, as it could overwrite parts of the OS without having the
OS stopping it because of a GPF)
Co-operative multi-tasking is also just a trick to do things 'in parallel'
without having to work with threads. The reason why some people still want
it is that they want to do things in parallel in a synchronious way, as in
pre-emptive multi-tasking it is undefined which thread gets the cpu and
when, so it requires extra code to make asynchronous code work as planned
and debugging that kind of code can be cumbersome.
We all do have synchronous multitasking code today: simply write a routine
and call from that routine your other routines. That's co-operative
multitasking. As I wrote earlier, a state-machine can help you with this.
You can chop up a long running routine into several states and hop between
them using the state machine, which then allows you to add states in
between these 'substates' to get things done in parallel, but in a
synchronous way. Using this I wrote 13 years ago a parallel computing
system for a 120-node sparc cluster (in C) which could schedule and
dispatch jobs on all the nodes, synchronously and in parallel without
having to have a lot of threads and syncing code in place.
Frans.
--
------------------------------------------------------------------------
Get LLBLGen Pro, productive O/R mapping for .NET:
http://www.llblgen.com
My .NET blog:
http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------