Date: Wed, 26 Aug 92 13:08:10 +0200
From: Martin_Schloeter@eurologic.fido.de (Martin Schloeter)
Subject: Re: Windows == OS
Newsgroups: comp.os.ms-windows.misc
X-Comment-To: tguez@jade.tufts.edu (Name)
Organization: Die ersten 100.000 Jahre... 

N > I have never seen any of the underline code for windows, but from
N > programming windows I say, with a great deal of confidence, that
N > windows is not even 10% an operating system.  It's one huge layered
N > APPLICATION.  Everything you do that interacts with the hardware goes
N > through a layer, i.e., another function call.
Quite normal for most operating systems.
N >   Instead of calling
N > malloc, one calls globalalloc which is probably nothing more than a
N > malloc that is hidden down somewhere plus some additional tracking
N > information.  
No, no. A malloc done with a DOS based app simply takes some memory out of the 
DOS memory pool a marks it as used. A GlobalAlloc create a new entry in the 
local descriptor table of the protected mode environment of the 286/386. 
N > Windows can move memory because it never gives you the
N > handle it gets from malloc, it keeps it and therefore could do what
N > ever it wants with it without affecting your application, 
No,no. In protected mode (standard and enhanced) there is no real difference 
between the handle and the pointer. There is only one bit switched for internal 
purposes. You can lock the memory in the moment you allocate it, can use the 
pointer and Windows is still able to move the block around. It's protected 
mode, not DOS!
N > These API function calls are great, they hide most of the hardware and
N > they do a lot of work for you and simulate an operating systems.
Nonsense. There is no DOS either device drivers between Windows and 90% of the 
hardware resources of the machine.
N > Windows still uses msdos drivers to do things and it will continue to
N > do this.  
Yes, but only on file system level!

N > Again, I never saw any of the code for windows but it seems to me that
N > the whole "windows programs" environment is nothing more than a setup
N > like this:
N > 
N > loop on tasks ( simply run through a linked list of data structures)
N >   get then WinMain function pointer of the current data-structure
N >   (*func_pointer)([the winmain parameters here]) ;
N >   get next pointer
N > end loop
Yes, that is cooperative multitasking. It's one way to implement a multitasking 
system. It's not the best way, but there were "historical" reasons to do it in 
this way. The alternative looks like:
  interrupt on task list (.....) 
    ...
    ...
  end loop.


N > In Petzold's introduction for windows programming, he writes something
N > to the effect,"...windows will not take away the cpu from a task in
N > the middle of a message processing....make's sense right?"  Of course
N > it does, windows could not take away the processing even if it
N > wanted to; All of windows "multi-tasking" is nothing more than very deep
N > function calls, so everything is on the stack and hence the message
N > (or actually the function) must finish so that the stack will come
N > back to this "ingenious" loop, and continue.
The only difference for a "real" preemptive multitasking system (for example 
Unix) is, that there it a timer driven interrupt mechanismen which 
automatically switches between the different tasks. All other things are the 
same. (In detail there are feature like separated address spaces for different 
task, but this has nothing to do with the basic mechanismen). 



N > I don't mean to be rude to anyone (not even Microsoft) but I am upset.
N > Somewhere in Petzold's book he says something like keep your message
N > processing short so other windows programs could run concurrently, and
N > if you have any big job to do divide your job to small parts and do it
N > with the help of the timer....
Another ways to release CPU time is to do 
  IF PeekMessage(...) THEN DispatchMessage.
And remember, Petzold is a relative old book and doesn't contain all.
N > That is really disguesting, windows
N > programs need to do the job of the operating system, provide the
N > "ticks." 
The ticks are a hardware feature managed by the OS Windows. 
N >  I have still to figure out this one:  in the control panel,
N > 386 enhanced setup, if you read the help about time slicning and all
N > that, it makes a soup out of the whole story and finally says that
N > ms-dos applications ("the old-applications") have a time slice setting
N > each, while windows programs share one setting.  Then, you get the
N > default of 20.  Now if you change it you get some differences in
N > behavior, but I still don't see how they could claim that windows
N > applications are actually and truely time-sliced given the discussion
N > above.
Windows apps are _NOT_ time sliced. There are running virtual machines, one for 
Windows an one for each DOS box with are time sliced by the sceduler of the 
underlaying VMM.


Greetings Martin
Newsgroups: comp.os.ms-windows.misc