Re: Why no trylock for read/write_bh?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Apr 12, 2009 at 11:25 AM, Jeffrey Cao <jcao.linux@xxxxxxxxx> wrote:
> On 2009-03-31, Peter Teoh <htmldeveloper@xxxxxxxxx> wrote:
>> sorry, i think i just worked out the logic (correct me if wrong).
>> ksoftirqd does not have any process context, so the input/output of
>> procfs comes / goes to where?   therefore, it becomes illegal to
>> access the procfs interface inside ksoftirqd context (kernel thread,
>> which does not have any process context, so can be executed in any
>> arbitrary process).
>>
>
> ksoftirqd does not have any process context? Then what context do you think
> it is in?
> What do you mean by "kernel thread can be executed in any arbitrary process"?
>

basic concept is that there 3 types of context:   process, hardware
interrupt, and software interrupt.

read this for further details (from LDDv3):

http://lwn.net/images/pdf/LDD3/ch07.pdf

within it explained what is a kernel thread.   So basically while
running process A in kernel mode, it can be intercepted by any kernel
threads, and these kernel threads therefore "DOES NOT HAVE PROCESS
CONTEXT", as they are not related to the currently running process A,
and therefore, must observe rules (described in ch07.pdf) like I/O,
sleeping etc. etc.

> As what as I know, Linux does not distinct thread from process. They have the
> same data structure task_struct. The different between thread and process is
> that thread shares some resources from its parent process which process does not.
>
> BTW, softirq does not exected only by ksoftirqd. It is executed in the following
> points also:
> 1/ When hard IRQ returns.
> 2/ When system return from kernel mode to user mode.
>
>
> --
> To unsubscribe from this list: send an email with
> "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
> Please read the FAQ at http://kernelnewbies.org/FAQ
>
>



-- 
Regards,
Peter Teoh

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux