c - Can multithreading be implemented on a single processor system? -


i have followed concept multithreading can implemented on multiple processors system there more 1 processor assigned each thread , each thread can executed simultaneoulsy. there no scheduling in case each of thread has separate resources dedicated it. recenetly read somewhere can multithreading on single processor system well. correct? , if yes difference between single processor , multiple processor systems?

of course can done on single-processor system, , in fact it's easier way. works same way running multiple processes -- kernel, via timer interrupt or other similar mechanism, suspends one, saving machine state, , replacing previously-saved state of -- difference being 2 threads of same process share same virtual memory space, making task-switch more efficient.

multi-threading on multi-processor systems more difficult, since have issues of simultaneous access memory multiple cpus/cores, , nasty memory synchronization issues arise out of that.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -