Does each thread is created as a different process?

Created at 2020-12-25 18:26:40

ab92c0c4a21fe89187cdb0ab237509fc.png
I create a two threads and used a global variable to communicate between them but it failed. I want to know that if each thread is a different process or a sub threads in a single process.

More

Follower
0
Views
801
2 Answers
DH04
DH04 2020-12-25

Different from PC OS,it's hard to describe the rt-thread's thread is a process or a sub-threads, these points may help you understand it:

  1. different thread in rt-thread share the same memory space, so the global variable and other ram space are accessible between threads
  2. each thread has its own context, so the general registers, local variables, are separated
varun
varun 2020-12-28

I fixed the problem myself. After writing the else part the program ran correctly without any error.

Write Your Answer

Log in to publish your answer.,Click here to log in.

Create
Post

Share