Context switch

Discussions and support about ChibiOS/RT, the free embedded RTOS.
Prathibha Prakash
Posts: 10
Joined: Sat Jun 22, 2019 6:15 pm

Re: Context switch

Post by Prathibha Prakash »

Hi,

As per the reference viewtopic.php?t=1870#p15421

"The low priority thread would perform its unlock because preempted threads are always in the ISR epilogue code that does exactly that"

How is it possible for the low priority thread to perform unlock after context switch,please can you explain this in detail.

I can't found out any documentation for this.
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Context switch

Post by Giovanni »

It is very simple, during a context switch this is what happens:

1) lock
2) switch
3) unlock

The lock is performed by the thread being switched out, the unlock is performed by the thread being switched in.

Giovanni
Post Reply