Kernel Threads

Submitted by Macross
on February 2, 2005 - 6:48am

Could someone help me with a way to permit user actions together with kernel actions , like a thread: kernel writing a great quantity of code on a device and user can use the keyboard, mouse, etc ... normally ...

I never used thread, so I supposed to use it as a way of multiple tasks between the spaces since thread works as a parallel process and let the main process continue it task, but the kernel_thread (ex) is specifically a thread for kernel tasks maintaining the "main task of the kernel" running not any type of task like user task ... there is a way to achieve this permition ????

why do it in kernel?

on
February 2, 2005 - 7:45am

Why can't you just do everything in userspace to e.g. let others be able to use your code without having to run a special Macross-kernel, that may be incompatible with their hardware or special needs? There these problems are solved, at least in the latest revisions. At least this is a good testing ground if you really never used threads, it is hard enough (and difficult enough to debug) in user space.

Inside the kernel afaik you have to sprinkle your code with cond_resched() calls and/or release spinlocks (and important semaphores?) in regular intervals.

Or buy one more CPUs than you have selfmade threads, if you don't lock global resources, this should help as well.

:o) thanx

on
February 2, 2005 - 8:42am

Yeahh, for my infelicity (lal) , people here are asking me to make a driver for a PCI device, and I need to access an asm level of programming , the best way I found with a good support of developing was under Linux Kernel Modules ... since it has an easy way of programming (C and a good open library) and accessing I/O mapped regions ... (comparing with asm or DDK -:o)-) ...

When you said about writing an user space code you opened my ideas a little about writing an IOCTL write function that just do One write per IOCTL, this way the user could create a Thread in user level for his own riscs making the programmer the possibility to administrate the data sending throw the timeline without doing an overflow of my hardware buffer... Guess the way is just testing...

My fears are about how this will reflect in my hardware application , since it has a critical application and it needs a very fast writing throw the data BUS on PCI ... doing just massive write on my hardware with "Linux" modules the system worked even sleeping (lal) but, my friend, in Windows ... a trash :o) ...

If the idea of user threads don't work, I guess is time to study semaphores as u said -- guess I will have to (even for necessity of learning something new) ...

Seems to be a good challenge for a 1 week IOCTL newbie kernel developer

Thanx again !

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.