| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Threads |
Original from Gerard Gerritsen to Peter Fitzsimmons on 04-01-1996
Original Subject: Threads
---------------------------------------
GG>> But how much difference will it make for a two threaded program ?
PF> A lot. DosEnterCritSec() _ALWAYS_ forces all other threads to stop.
GG> But since there are only two threads that should not make any difference.
It certainly does. With DosEnterCritSec, the second thread will be
stopped no matter what it is doing. Even if it is nowhere near
anything that might be a resource conflict.
PF> A semaphore will only cause another thread (or the thread asking for
PF> the semaphore) to stop if and only if there has been a collision with
PF> that semaphore.
PF> Big difference.
GG> I do not know for sure but I think using DosEnterCritSec
GG> takes less overhead then using semaphores ?
Nope..
The "intent" of Semaphores and CritSec is quite a bit different.
Semaphores are intended to prevent resource collisions or sycronize
threads. CritSec is meant to make sure one thread is given ALL the cycles
within a single
process.
Sure you can use CritSec in place of a Semaphore, just as you could
use a Crop Duster in place of a Flyswatter. But the side effects might
be more than you intended..
Denis
Certified OS/2 Engineer, Certified OS/2 Instructor, Certifiable....
All opinions are my very own, IBM has no claim upon them
.
--- Maximus/2 3.01
* Origin: T-Board - (604) 591-8208 (1:153/908)SEEN-BY: 50/99 78/0 270/101 620/243 711/401 409 410 413 430 808 809 934 955 SEEN-BY: 712/407 515 517 628 713/888 800/1 7877/2809 @PATH: 153/908 969 800 270/101 712/515 711/808 809 934 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.