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
38
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
Bangalore
Activity points
1,582
hi

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

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

Somashekhar

Member level 2
Joined
Jan 4, 2010
Messages
47
Helped
9
Reputation
18
Reaction score
8
Trophy points
1,288
Location
India
Activity points
1,538
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
 

papunblg

Advanced Member level 3
Joined
Oct 22, 2010
Messages
726
Helped
172
Reputation
344
Reaction score
165
Trophy points
1,343
Location
Kolkata India
Activity points
6,437
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
 

eziggurat

Full Member level 6
Joined
Feb 15, 2002
Messages
324
Helped
30
Reputation
62
Reaction score
19
Trophy points
1,298
Activity points
2,930
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

Top