Click here to Skip to main content
14,640,250 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.
 
GeneralRe: APOD Pin
glennPattonWork11-Jul-18 9:10
professionalglennPattonWork11-Jul-18 9:10 
GeneralWhat are all those threads in Windows doing? Pin
Marc Clifton11-Jul-18 3:52
mvaMarc Clifton11-Jul-18 3:52 
GeneralRe: What are all those threads in Windows doing? Pin
F-ES Sitecore11-Jul-18 4:02
mveF-ES Sitecore11-Jul-18 4:02 
GeneralRe: What are all those threads in Windows doing? Pin
Eddy Vluggen11-Jul-18 4:46
professionalEddy Vluggen11-Jul-18 4:46 
GeneralRe: What are all those threads in Windows doing? Pin
patbob11-Jul-18 5:53
Memberpatbob11-Jul-18 5:53 
GeneralRe: What are all those threads in Windows doing? Pin
Member 798912211-Jul-18 9:22
MemberMember 798912211-Jul-18 9:22 
GeneralRe: What are all those threads in Windows doing? Pin
patbob11-Jul-18 10:34
Memberpatbob11-Jul-18 10:34 
GeneralRe: What are all those threads in Windows doing? Pin
Member 798912211-Jul-18 22:33
MemberMember 798912211-Jul-18 22:33 
The classic Mac OS was the same way - purely event driven. (I learned the philosophy of event driven programming by reading about Mac OS several years before I encountered Windows in pratice!)

In the classic Win32 model, events were routed to an entity called a 'Window', because it almost always had one. But it didn't have to! Today, a 'process' serves the same role: Like a window entity handled a number of events, and the processing of them, the 'process' handles a number of threads. The main difference is that while processing an event (i.e. a message) always completed within a short time, a thread may stop midway, waiting for 'something' - the 'something' is not modeled as an event/message, but as something else.

Note that in *nix (as well as many other OSes), the 'process' is an actively executing entity. Threads are just subdivisions of the activity within a process. A Windows process is not by itself executing; it is a container for one or more threads - just like a win32 window didn't by itself do any processing: Each message handling procedure did.

It could have been modeled as an event/message - the main difference is that the thread model allows the thread to have its local data across those waits. In an event model, a 'windows'/process maintains a data structure which is modified by micro-operations (i.e. individual event procedures) completing in finite time (conceptually: zero time). There is never any deadlock, never any wait for someone else to complete so the data structure is 'released'; no data is ever 'reserved'. The FSM may indicate that in a given state, a given event is illegal and should be treated as an error, but that never causes a deadlock.

You could think of the classical processing of an event as a one-shot thread: It is fired up, does its job (in an atomic manner) and terminates. Introducing the pausing of a thread midway, doing more than an atomic micro-operation, caused threads to grow fat. When lots of data were hidden inside threads, many threads were packed into one process, so that they grew fat, frequently encompassing the entire application. In win32, you would leave one data structure to one 'window', as an FSM of one data structure (say, the state info for protocol), making more 'windows' for other data structures. Your application would be organized as a number of cooperating FSMs, or 'windows', the way networking people have been doing for ages.

I never saw an introductory college textbook promoting this design philosophy (not even in the days of classic Mac OS and win32) - you would learn it only in advanced, telecom oriented courses, long after your basic approach to programming has been molded into the multiple-thread and locked-up data structures way of thinking.

So the FSM / event concepts were lost. And few people are aware of what was lost; they never knew that it existed.
QuestionRe: What are all those threads in Windows doing? Pin
MSBassSinger12-Jul-18 7:44
professionalMSBassSinger12-Jul-18 7:44 
AnswerRe: What are all those threads in Windows doing? Pin
Member 798912212-Jul-18 21:43
MemberMember 798912212-Jul-18 21:43 
GeneralRe: What are all those threads in Windows doing? Pin
sickfile13-Jul-18 5:38
Membersickfile13-Jul-18 5:38 
GeneralRe: What are all those threads in Windows doing? Pin
obermd12-Jul-18 10:22
Memberobermd12-Jul-18 10:22 
GeneralRe: What are all those threads in Windows doing? Pin
DRHuff11-Jul-18 9:24
MemberDRHuff11-Jul-18 9:24 
GeneralRe: What are all those threads in Windows doing? Pin
Nelek11-Jul-18 20:01
protectorNelek11-Jul-18 20:01 
GeneralRe: What are all those threads in Windows doing? Pin
TNCaver12-Jul-18 7:41
MemberTNCaver12-Jul-18 7:41 
GeneralRe: What are all those threads in Windows doing? Pin
Gary Wheeler11-Jul-18 7:20
MemberGary Wheeler11-Jul-18 7:20 
GeneralRe: What are all those threads in Windows doing? Pin
raddevus11-Jul-18 8:46
mvaraddevus11-Jul-18 8:46 
GeneralRe: What are all those threads in Windows doing? Pin
Marc Clifton11-Jul-18 11:36
mvaMarc Clifton11-Jul-18 11:36 
GeneralRe: What are all those threads in Windows doing? Pin
Member 798912211-Jul-18 21:56
MemberMember 798912211-Jul-18 21:56 
GeneralRe: What are all those threads in Windows doing? Pin
Stuart Dootson12-Jul-18 6:24
professionalStuart Dootson12-Jul-18 6:24 
QuestionHow do you handle this? Pin
Eytukan11-Jul-18 3:44
MemberEytukan11-Jul-18 3:44 
AnswerRe: How do you handle this? Pin
Marc Clifton11-Jul-18 3:48
mvaMarc Clifton11-Jul-18 3:48 
GeneralRe: How do you handle this? Pin
Eytukan11-Jul-18 4:00
MemberEytukan11-Jul-18 4:00 
GeneralRe: How do you handle this? Pin
raddevus11-Jul-18 4:53
mvaraddevus11-Jul-18 4:53 
GeneralRe: How do you handle this? Pin
Eytukan11-Jul-18 7:56
MemberEytukan11-Jul-18 7:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.