Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Apartment Model Threading
Message
From
15/08/1999 19:18:39
 
 
To
15/08/1999 18:49:48
General information
Forum:
Visual FoxPro
Category:
Internet applications
Miscellaneous
Thread ID:
00252574
Message ID:
00253922
Views:
26
>Ed,
>
>I made a note of the book and will be calling my favorite local bookseller on Monday to enquire.
>
>Not to belabour the point, but "cooperative" multitasking makes it sound like there can be non-cooperative tasks (and I certainly recollect people stating that a certain problem was encountered because a product did not comply to cooperative multitasking.
>

Actually, cooperative multiutasking relies on all processes to periodically release control back to the operating system; this was the basic design of the Mac OS early in its release. This was also the strategy pursued by the releases of Windows prior to Win3.0.

the premise of preemptive multitasking is that a process will run until either an operating system function is onvoked, or it exhausts its alloted time on the CPU. A central dispatcher manages the decision of how many cycles are granted to which pending task.

Preemption assures that the operating system regains control of the processor at regular intervals in the worst case, to share the processor(s) among the pool of pending tasks, and to allow responses to global events in a timely fashion. It in no way prevents processes that are smart enough to know that they're burning cycles needlessly waiting for an external event to tell the operating system that until the event(s) occur, there is no reason to grant the process furthertime on the CPU. Invocation of operating system functions in a synchronous (blocking) fashion suspends the process until the operating system has satisfied or denied the request.

Multithreading allows a process to spawn multiple threads of execution that can operate, at least to some extent, independent of each other (asynchronously). Threads can, if necessary, communicate between themselves so that when one thread becomes dependent on completion of a task by another or requires exclusive use of a resource shared by all the threads of a process, it notifies the operating system that it can't gainfully employ the processor until another thread signals that it has completed its assigned task. The same basic mechanism is used to coordinate inter-process communications as is available for intra-process communications and synchronization.

For a more comprehensive coverage of the theory, you might want to investigate Lorin and Deitel's Operating Systems; the first half of the book is devoted to theory, and the second half to case studies of various operating systems, allowing you to see how hardware and software design decisions influence the behavior of different operating systems, in some cases on the same hardware (for example, comparing MVS and VM/CMS on big IBM iron of the mid-1980s, and comparing DEC's VMS to a couple of Unix implementations on the VAX. It also discusses early implementation of the Mac OS, OS/2 and Windows.) It's great from the theory and comparison perspective, but doesn't cover the underpinnings of Win32 anywhere near as comprehensively as Richter, who has one environment to deal with.

>I also realized that in *any* multitasking OS things are more complicated than I described, but I was trying to get a 'essence' of the primary thing.
>
>It still looks to me that "cooperative multitasking" **CAN** result in problems (becauae the task going into 'wait' has options) whereas genuine 'preemptive multitasking' offers no such possibilities. But the main point that started this is now to bed regardless of the details.
>

No, as mentioned, preemption is a worst-case scenario; the operating system only steps in where the process needs more CPU cycles to complete than it has been granted. I'm not aware of any preemptive implementation that precludes voluntary yielding of the processor, or how voluntarily blocking on the availability of a resource or completion of another task complicates the issue. In both preemptive and cooperative strategies, the operating system has to maintain lists of processes that can be dispatched, track their relative priority of dispatch when waiting on a processor to ecome available, and track when processes that aren't eligible for dispatch become either dispatchable or terminated. It's a matter of what happens if someone insists they need more time than they're entitled to...
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform