• Post Reply Bookmark Topic Watch Topic
  • New Topic

Difference between Physical Threading and Logical Therading  RSS feed

 
Marking Fishering
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I have the following understandings about these two concepts:

1. Let us consider a PC with quad-core processor. That means this PC has 4 logical cores, where each of these logical cores stands for a physical thread. So, a quad-core processor has 4 physical threads.

2. When we create an object of Thread class in Java, we actually create a logical thread. A physical thread can process two logical threads at a time if hyper-threading is supported.

Can anyone please verify my understandings? And, can anyone please explain the differences between these two concepts in more detail?

Thanks a lot in advance!

 
Henry Wong
author
Sheriff
Posts: 23283
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Marking Fishering wrote:
1. Let us consider a PC with quad-core processor. That means this PC has 4 logical cores, where each of these logical cores stands for a physical thread. So, a quad-core processor has 4 physical threads.


A quad core processor can run four thread simultaneously. This means that the OS can schedule four threads for the processor to run -- and of course, also have an understanding that there is more than one currently running thread.

Marking Fishering wrote:A physical thread can process two logical threads at a time if hyper-threading is supported.


Hyper-threading is the capability of the processor to run more than one thread per core. As far as the OS is concerned, it sees a four core hyper-threaded processor as having eight cores... and will try to schedule eight threads onto the processor simultaneously.

Henry
 
Marking Fishering
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Henry, thanks for your quick reply! I have the following questions just for the clarification..

A quad core processor can run four thread simultaneously. This means that the OS can schedule four threads for the processor to run -- and of course, also have an understanding that there is more than one currently running thread.


By four thread, do you mean physical threads?


Hyper-threading is the capability of the processor to run more than one thread per core. As far as the OS is concerned, it sees a four core hyper-threaded processor as having eight cores... and will try to schedule eight threads onto the processor simultaneously.


In this part, do you mean logical threads?


Thank you once again!
 
Henry Wong
author
Sheriff
Posts: 23283
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Marking Fishering wrote:
A quad core processor can run four thread simultaneously. This means that the OS can schedule four threads for the processor to run -- and of course, also have an understanding that there is more than one currently running thread.


By four thread, do you mean physical threads?


In this case, I mean the entity that the OS schedules to run on the processor. For the Java application, these threads are represented by the Thread object(s).

Marking Fishering wrote:
Hyper-threading is the capability of the processor to run more than one thread per core. As far as the OS is concerned, it sees a four core hyper-threaded processor as having eight cores... and will try to schedule eight threads onto the processor simultaneously.


In this part, do you mean logical threads?


In this case, I mean the entity that the OS schedules to run on the processor. For the Java application, these threads are represented by the Thread object(s).


BTW, can you give us the source of your terminology? What do you mean by "logical threads" and "physical threads"?

Henry
 
Marking Fishering
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

BTW, can you give us the source of your terminology? What do you mean by "logical threads" and "physical threads"?


Thnaks for asking, Henry. This is where I got the concepts of Physical and Logical Threading.

https://www.ibm.com/developerworks/community/wikis/form/anonymous/api/wiki/b7da455c-5c51-4706-91c9-dcca9923c303/page/35e0361a-c781-4ff2-a4cc-63a224a0b5c3/attachment/6c315754-c65a-4692-9f41-23fccae5c184/media/RSARTE%20Concepts.pdf


 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That document seems to be discussing a specific VM implementation designed to be real-time, and run only on real-time OSes. Whatever it says about threads and scheduling can not be generalized to Java in general, as Java in general is not a real-time platform.
 
Henry Wong
author
Sheriff
Posts: 23283
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Steve Luke wrote:That document seems to be discussing a specific VM implementation designed to be real-time, and run only on real-time OSes. Whatever it says about threads and scheduling can not be generalized to Java in general, as Java in general is not a real-time platform.



I am not even sure if it is even an implementation. There is lots of talk about its relationship with UML. And how the framework uses C++, but it is not language (or implementation) dependent. And at the moment ... I am too lazy to do any more investigation...

Henry
 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Henry Wong wrote:I am not even sure if it is even an implementation. There is lots of talk about its relationship with UML. And how the framework uses C++, but it is not language (or implementation) dependent. And at the moment ... I am too lazy to do any more investigation...

I think the document is for RSARTE, which is sort of a UML - to language convertion application. You can define the architecture in UML and then translate it to real code. I had heard of it to create Java apps to run in their Websphere Real Time/Real Time Specification for Java implementation, so I assumed it was a building tool for that. Further investigation indicates it can translate to a number of different languages.
 
Charles Rivet
Greenhorn
Posts: 1
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
RSARTE is a modeling tool for reactive embedded systems that implements UML-RT, which is based on the ROOM methodology.

The logical threads are only used when creating the model of the application to create groups of capsules (think of them as components with behaviours defined by state machines with run-to-completion semantics) that "belong" together or to segregate capsule that need to be on their own. At some point, especially when the hardware is defined and available, the logical threads are mapped to actual, processor physical threads.

Because of the specific behaviour of the runtime system provided by RSARTE, you could think of logical threads as being similar to fibers.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!