Tip:
Find number of cores in windows OS : wmic cpu get NumberOfCores
Find number of processors in windows OS : systeminfo | find/i "processor(s)"
Multitasking:
This is the task of the underlying OS which is capable of doing multitasking with in the single/multiprocessor systems or single/multicore systems. The OS does multitasking with the help of Context switching(needed only in single core/single processor systems) and with some scheduling algorithms. Ex: Windows XP Operating system.
For example, consider the below image. Here word, Mail etc... are called as an applications and each run as a separate processes. If you open the task manager in windows OS you can see them running as a process. The OS uses the schedulers and does context switching or schedule it in multiple core/processors. In a single core/processor at a time only one process will be running but when u invoke a new process the scheduler preempt the old and calls the new processor which gives the feeling of all process running on a same time. In multiprocessor/multicore systems the process will be running parallel.
If the OS supports multitasking, then the only difference in multicore/multiprocessor system is the performance. The multiple core/processor systems does not need to wait for a single processing unit which increases the performance.
[caption id="attachment_388" align="alignnone" width="300"]

Multithreading:
In concurrent programming there are two basic units of execution, namely
- Process
- Thread
Thread is a smallest sequenced set of instructions in execution. There are native threads at OS level but java has it's own threads and JVM works as a min OS and schedules it's threads internally. In some situations java threads are mapped to native threads.
Process is an instance of computer program that is running and process can have multiple threads. So in the above example, if we take email application it is a single process. But in turn it can have multiple threads and each used for listening incoming messages or to send a mails or to search etc.. Programming in this was will enhance the application speed. If there is no threads then the email as a process will get very less chance to execute in the CPU, but if it has multiple threads then the chances of each thread getting CPU to do the part of the process's job will increase the performance of the application.
[caption id="attachment_394" align="alignnone" width="300"]

Multicore & Single Core:
A multicore system is a single processor CPU but with two or more core and each core with it's one microprocessors for execution. Some components of CPU like L1 Cache are duplicated for each core.
[caption id="attachment_387" align="alignnone" width="300"]

In single core system, there will be one CPU and it contains only one core.
[caption id="attachment_386" align="alignnone" width="300"]

Multiprocessor & Single processor:Multiprocessor system is a system with multiple CPU's (Central processing unit) whereas in Single processor system has only one CPU. Here the process/ threads will be scheduled to different processors and no context switching is required.
No comments:
Post a Comment