Tuesday, January 17, 2017

Lecture 04 - Concepts of Programming - Part II



What is a Computer Program?
A computer program is a sequence instructions that when performed in a computer carry out a particular task. There are two ways to run a program in a computer.

Sequential Processing
The instructions are performed one after the other using the computer. The program is stored in the memory and instructions are fetched one by one and executed within the CPU.

Example:

Input A
Input B
Total = A+B
Print Total

Concurrent Processing
The instructions are performed in parallel within the computer. This may be done using multiple processors or using the same processor with time sharing. This type of concurrent processing increases the efficiency and more common in networked environments.

Example:

Thread 1:
Input A
Input B
Total = A+B
Print Total

Thread 2:
Read C,D
Total = Total + C + D
Print Total

In this situation Thread 1 and Thread 2 process at the same time. The processor no need to wait until the thread 1 finished to start thread 2.

No comments:

Post a Comment

Important Notice!

Dear students and friends. When you commenting please do not mention your email address. Because your email address will be publicly available and visible to all. Soon, it will start sending tons of spams because email crawlers can extract your email from feed text.

To contact me directly regarding any inquiry you may send an email to info@bcslectures.website and I will reply accordingly.