just wondering how windows do multitasking, i mean if there are 20 threads running 'at the same time' how does windows stop some thread and run the appropriate next one. i mean, when thread is 'going on' it doesnt know that it must stop, it just do her stuff, then windows stop it, run next thread and then again this thread. how is this done? its like something would stop processor at some interval and do its job, and then thread would be doing again, and then something will stop thread again...like interrupt or sth, is it possible to write software interrupts that stop processor and go to appropriate program and then again back to running thread?
Posted on 2001-02-18 17:29:00 by geecko
you got it, windows multitasking is based on the timer interupt which wont help you much. This interupt gets called every so oftern. And windows swiches threads, this is done via some special CPU instructions to minimizes processor time and save to context of the old Thread. Anyway, its not possible to call interupts unless you write a VxD. However windows does have some API to allow different threads to work with each other. For one is the Sleep function: It allows your thread to 'sleep' for a specified number of milliseconds or give up the rest of its timeslice (The amount of milliseconds that windows gives each thread on the system to run.) Windows also has many other functions that work with 'events'. Lookup 'CreateEvent'.
Posted on 2001-02-18 23:11:00 by George
thank you for the answer, i was pretty close:)
Posted on 2001-02-19 13:17:00 by Geecko