Results 1 to 1 of 1
Dear All,
I have created a workqueue as follows,
static DECLARE_WORK(task1, file_read, NULL);
static DECLARE_WORK(task2, file_write, NULL);
init_module()
{
sample_wq=create_workqueue("sample1");
BUG_ON(!sample_wq);
if (!queue_work(sample_wq, &task1))
printk("\nProblem in Running Sample1 Workqueue....................\n");
if ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 07-13-2010 #1Just Joined!
- Join Date
- Sep 2005
- Location
- Bangalore
- Posts
- 7
Running workqueues in linux
Dear All,
I have created a workqueue as follows,
static DECLARE_WORK(task1, file_read, NULL);
static DECLARE_WORK(task2, file_write, NULL);
init_module()
{
sample_wq=create_workqueue("sample1");
BUG_ON(!sample_wq);
if (!queue_work(sample_wq, &task1))
printk("\nProblem in Running Sample1 Workqueue....................\n");
if (!queue_work(sample_wq, &task2))
printk("\nProblem in Running Sample2 Workqueue....................\n");
}
In file_read and file_write tasks i am printing the smp processor id as follows,
void *hcpu = (void *)(long)smp_processor_id();
int cpu = (long)hcpu;
printk("\nCPU%d\n", cpu);
I am expecting the tasks to run in two CPUs in parallel manner. But i they are running serially. Output looks like follows,
file_read is running on CPU0
file_write is running on CPU0
file_read is running on CPU1
file_write is running on CPU1
My expected output is,
file_read is running on CPU0
file_write is running on CPU1
file_read is running on CPU0
file_write is running on CPU1
Can anybody tell me what mistake i am doing here?
Thanks,


Reply With Quote
