Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

difference between Threading and functions in C++

Status
Not open for further replies.

srija

Member level 1
Joined
Oct 26, 2011
Messages
37
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
Bangalore
Activity points
1,567
hi

I am new in threading...........

can anybody tel me what is the difference between functions and threads in C++????
 

Threads :
o multithreading means multiple lines of a single program can be executed at the same time
o the operating system is treating the programs(threads) as two separate and distinct processes
 

C++ does not contain any built-in support for multithreaded applications. Instead, it relies entirely upon the operating system to provide this feature.
Language-level support for multithreading usually means offering only a “lowest common denominator” of features. With C++, you gain access to all the features that the operating system provides. This is a major advantage when writing high-performance code.

---------- Post added at 11:58 ---------- Previous post was at 11:56 ----------

In Java there are predefined classes for thread programming(Thread class)

---------- Post added at 12:17 ---------- Previous post was at 11:58 ----------

In a thread based multitasking environment , the thread is the smallest unit of dispatchable code. A single program can perform two or more tasks simultaneously(well, almost, for a single processor). Multithreading enables you to write very efficient programs that make maximum use of CPU(low idle time).

Whereas, a function is a block of source code which does one or some tasks with specified purpose and can be called to perform as many time it is needed.

In very simple words this is the difference between function and thread
 

I wouldn't say a multiple thread run at the same time. More like prioritized by the scheduler.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top