Multicore, Thread & Multi threading






Multiprocessing




 Within the past several years, multiprocessor systems (also known as parallel systems or multicore systems)
 The multipleprocessor systems in use today are of two types. Some systems use asymmetric multiprocessing, in which each processor is assigned a specific task.
 Aboss processor controls the system; the other processors either look to the boss for instruction or have predefined tasks. This scheme defines boss–worker relationship.



 The most common systems use symmetric multiprocessing (SMP), in which each processor performs all tasks within the operating system.
 A recent trend in CPU design is to include multiple computing cores on a single chip. Such multiprocessor systems are termed multicore.

Thread

A thread is a basic unit of CPU utilization, consisting of a program counter, a stack, and a set of registers, ( and a thread ID. )




As shown in Figure multi-threaded applications have multiple threads within a single process, each having their own program counter, stack and set of registers, but sharing common code, data, and certain structures such as open files.

Thread: Types USER LEVEL THREAD



User thread are implemented by users. OS doesn’t recognized user level threads. Implementation of User threads is easy. Context switch time is less.
Context switch requires no hardware support.


 KERNEL LEVEL THREAD



kernel threads are implemented by OS. Kernel threads are recognized by OS.
Implementation of Kernel thread is complicated.
Context switch time is more and Hardware support is needed.

 What is program counter ?



 Different between the program counter and register :  Register?



 Flip-flop register?



program counter (just for.....)  What is program counter
A program counter is a register in a computer processor that contains the address (location) of the instruction being executed at the current time. As each instruction gets fetched, the program counter increases its stored value by one.


  Different between the program counter and register :

counter (PC) holds the address of the next instruction to be executed, while the instruction register(IR) holds the encoded instruction. Upon fetching the instruction, the program counter is incremented by one "address value" (to the location of the next instruction).

program counter (just for.....)



There are various types of Registers those are used for various purpose. Some Mostly used Registers are Accumulator(AC), Data Register(DR), Address Register(AR), Program Counter(PC), Memory Data Register (MDR), Index Register(IR), Memory Buffer Register(MBR). Registers are used for performing the various operations.



Flip-flop is a 1 bit memory cell which can be used for storing the digital data. ... The binary data in a register can be moved within the register from one flip-flop to another.

Multi threading
 For example in a word processor, a background thread may check spelling and grammar while a foreground thread processes user input ( keystrokes ), while yet a third thread loads images from the hard drive, and a fourth does periodic automatic backups of the file being edited.



 e.g. VLC media player, where one thread is used for opening the VLC media player, one thread for playing a particular song and another thread for adding new songs to the playlist.



 Multi threading is the ability of a process to manage its use by more than one user at a time and to manage multiple requests by the same user without having to have multiple copies of the program.

Multi threading Why Multithreading?
A thread is also known as lightweight process. The idea is to achieve parallelism by dividing a process into multiple threads. For example, in a browser, multiple tabs can be different threads.

MultiprocessingUse
 Multiprocessing processes at same refers to processing of multiple time by multiple
 CPUs.


 It utilizes multiple CPUs.



 It permits parallel processing.



 Less time taken to process the jobs.



 It facilitates much efficient utilization of devices of the computer system.



 Usually more expensive.

Multiprogramming-Use
 Multiprogramming keeps several programs in main memory at the same time and execute them concurrently utilizing single CPU.




 It utilizes single CPU.



 Context switching takes place.



 More Time taken to process the jobs.



 Less efficient than multiprocessing.



 Such systems are less expensive.

1.To access the services of operating system, the interface is provided by the a) System calls
b) API
c) Library
d) Assembly instructions



Answer:



2.Which one of the following is not true?
a) kernel is the program that constitutes the central core of the operating system b) kernel is the first part of operating system to load into memory during booting
c) kernel is made of various modules which can not be loaded in running operating system
d) kernel remains in the memory during the entire computer session



Answer:

3.The main function of the command interpreter is
a) to get and execute the next user-specified command
b) to provide the interface between the API and application program c) to handle the files in operating system
d) none of the mentioned










4.By operating system, the resource management can be done via a) time division multiplexing
b) space division multiplexing
c) both time and space division multiplexing d) none of the mentioned

5. If a process fails, most operating system write the error information to a ______
a) log file
b) another running process c) new file
d) none of the mentioned





6. The OS X has ____________ a) monolithic kernel
b) hybrid kernel c) microkernel
d) monolithic kernel with modules

7. The main function of the command interpreter is
a) to get and execute the next user-specified command
b) to provide the interface between the API and application program c) to handle the files in operating system
d) none of the mentioned









8. By operating system, the resource management can be done via a) time division multiplexing
b) space division multiplexing
c) both time and space division multiplexing d) none of the mentioned

9. Which one of the following error will be handle by the operating system?
a) power failure
b) lack of paper in printer
c) connection failure in the network d) all of the mentioned

10.Which one of the following is not a real time operating system?

a) VxWorks
b) Windows CE c) RTLinux
d) Palm OS

11. If a process fails, most operating system write the error information to a ______
a) log file
b) another running process c) new file
d) none of the mentioned

Answer
1.a 2.c 3.a 4. c 5.a 6.b 7.a 8.c 9.d 10.d 11.a

1. What is operating system?
A. collection of programs that manages hardware resources B. system service provider to the application programs
C. link to interface the hardware and application programs D. all of the mentioned


3. The operating system can handle A. power off
B. lack of paper in printer
C. failure in the network connection D. all of the mentioned



5. Which one is related to kernal?

a) kernel is the program that constitutes the central core of the operating system
b) kernel is the first part of operating system to load into memory during booting
c) kernel is made of various modules which can not be loaded in running operating system
d) a & b true

Comments

Post a Comment

Popular posts from this blog

(PCB) or Task Control Block (TCB)

Basic: Operating System

Buffering, Polling & Spooling