Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
342 Views

Question about SGX Threading

Hi

    I know intel sgx can support multithreading and an enclave can have several tcs.

    In multicore system, what's the mapping relation between the SGX threads and cpu cores?If one tcs is mapped to one core, enclave threads are limited by cpu core number.

    SGX threads are mapped directly to logical processors ? Why?

Thanks!

0 Kudos
6 Replies
Highlighted
342 Views

Hi,

>> I know intel sgx can support multithreading and an enclave can have several tcs. In multicore system, what's the mapping relation between the SGX threads and cpu cores?If one tcs is mapped to one core, enclave threads are limited by cpu core number.

SGX thread is mapped directly to logical processor. For example consider a  multi core system having 4 processors and each one supporting two cores.Since there is one to one mapping exists between the enclave threads and logical processor, here the number of enclave threads(that can run in parallel) are limited to 4*2 =8.

>> SGX threads are mapped directly to logical processors ? Why?

In non sgx environment, User threads are mapped to one or many kernel threads to achieve more parallelism. But kernel threads are controlled by the OS. There might be possibility of attack on these kernel threads due to malware OS. In order to avoid this security issue, SGX threads are mapped directly to Logical processor.

-Surenthar

0 Kudos
Highlighted
Beginner
342 Views

Thank you very much Surenthar!

0 Kudos
Highlighted
Employee
342 Views

Threads running inside an enclave are the same threads running the user application, and the OS is responsible for all thread scheduling.

The main difference is that while a thread is running within an enclave it uses a stack and (sgx) thread descriptor that are inside the enclave. These are different from the stack and thread descriptor the thread has while running outside, which are assigned by the OS.

The number of threads that can run simultaneously inside an enclave is limited by the number of TCSes. The number of TCSes is limited by the amount of EPC memory available.

0 Kudos
Highlighted
Beginner
342 Views

Juan D. (Intel) wrote:

Threads running inside an enclave are the same threads running the user application, and the OS is responsible for all thread scheduling.

The main difference is that while a thread is running within an enclave it uses a stack and (sgx) thread descriptor that are inside the enclave. These are different from the stack and thread descriptor the thread has while running outside, which are assigned by the OS.

The number of threads that can run simultaneously inside an enclave is limited by the number of TCSes. The number of TCSes is limited by the amount of EPC memory available.

In the example above, if you have 10 Tcses in a multi core system which has 8 logical processors. How many threads can you run ?

0 Kudos
Highlighted
342 Views

 

Since there is an one to one mapping exists between the enclave threads and logical processor, here the number of enclave threads that can run in parallel for a system which has 8 logical processors are 8. 

0 Kudos
Highlighted
Employee
342 Views

Your application may create 10 threads to run inside the enclave. However, as Padma said, if the platform the enclave is running on has 8 logical processors, only 8 threads may be running simultaneously at any point of time. The remaining two will be scheduled in/out by the OS.

0 Kudos