Question

1) What is difference between multiprocess and multicore with respect to programming?

2) For multithreading we need to save shared-data through mutex and synchronization, what about a program running on multicore ?

3) If I have a single process in my program and running it at multicore environment ? processing Will be faster or not?

Was it helpful?

Solution

1) I am assuming that by multiprocess you mean splitting up one program into multiple processes (which is usually done with the fork() method in POSIX systems) as opposed to multitasking. The usual definition of multiprocessing or multitasking is that of allowing a single CPU to run multiple processes seemingly in parallel by switching between them very often. Multicore means that a single CPU can have more than one core capable of executing tasks and has all execution units connected in some way (depending on the architecture of the processor). These things usually have no influence on how you program, unless you are writing very low level software, such as an operating system. Forking processes (which I believe you mean) is usually done through some method provided by the operating system and is actually huge topic, which you can find a lot of books about.

2) Operating systems often provide abstraction to the underlying CPU architecture, meaning that you as the programer do not have to concern yourself with whether you PC does have a multicore CPU or a single core, so if you use multithreading you still have to share your data just the same way. If you are writing the operating system for a multicore CPU then things become way harder and you will have to read up on the instructions which the CPU supports.

3) If your program only has a single process (and spawns no threads) then execution will be (nearly) identical no matter whether it is run on a single core or a multicore system. The only speed benefit it could gain on a multicore system could occur from the operating system pushing it onto a core on which not many other tasks are running, thus giving it more CPU time with fewer task switches. A real gain from using multicore systems can only be achieved by using parallel programming.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top