>On 2001-08-03 23:17:19, J. Weeks wrote:
>>Is the following function preemptable ?
>>
>>void test_kernel_function() {
>> int i=100000;
>> while (i--);
>>}
>
>Yep.
>
Hi j.weeks !
To make my question cleaner(for myself too
)
If the C compiler stores a variable on stack,not global,
(I think all locals are stored that way if not explicitly overridden)
it is enough for that ?
>>What I expect from the above function is that,when it is
>>preempted it will set i=100000 so when the preemted process
>>gains back controll it will have an undefined value in i !
>>
>>Am I completly on the wrong way ?
>
>Usually (pretty much always
in a multitasking
>environment each application has it's own memory
>space. No other application is able to alter the
>memory of another application, therefore your 'i'
>variable is perfectly safe.
>
Yeah,that was clear !!!
But test_kernel_function() is a function in kernel that
can be called from any app at any time !!
>Some problems with multitasking involve the kernel
>itself: what if two applications call the same
>function? For example, two separate programs
>tell the OS to read a sector from the HD. If that
>OS function uses the same buffer for each read,
>and is interrupted in the middle, you've got a
>problem... the wrong data may be sent to the wrong
>program.
>
>Also, consider the following:
>
>Program A is waiting for a responce from Program B
>Program B is waiting for a responce from Program A
>
>Both programs are at a stale mate, waiting for
>responces from each other. The two processes are
>effectively hung.
>
Isn't is this theme is a matter of deadlocks ?
I don't see relation to preemption !!
>>I would also like to discuss microkernels in detail
>>(general concepts,message-passing,memeory managment,etc..).
>>If you also feel so(and have patience for me),
>>drop me an email:
[email protected]
>
>I've got some knowledge on that stuff... not a whole
>load, that's why I'm writting an OS in the first place -
>to learn more about it
I might be able to help
>you with some stuff, though.
>
Is there a way to meet you more interactivly ?
>j.weeks