RE: real-time process

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

 



>i work on a real time streaming project and i have two seperate

>threads which have infinite loops in them.

Whats the appx MAX bandwidth needed for ur application ?

Whats ur CPU speed ?

>first of all, what should i do in order to make this application a real
time process? If i set

>the thread attributes of these two threads to SCHED_FIFO and if htey have
different priorities, does it mean

>that the one with the higher priority will always use the CPU? and also
what about all the other

>processes in the system that need CPU time?

I dont think that u can make any process REAL Real Time.

Instead u can reduce the application callbacks by driver to

achieve better performance.

U can try increasing the priority of ur application over others through

ssched_setscheduler() with sched_param->sched_priority =
sched_get_priority_max(SCHED_RR/FIFO);

So that ur appl get CPU attention first.

If ur appl involves heavy data xfer, u can try to make it as fast as
possible with these steps.

1. implement mmap() for the driver and try to get as big kernel memory space
as possible.

( usually u'll need DMA capable, non swappable memory ). Then implement n
buffering in it.

2. use some ioctls to select the buffer u want to xfer.

3. The application will fill in the buffer and talk to driver with ioctls
and tells it to start/stop xfer.

 The ioctl is non blocking.

4. Application does a sleep() to wait for intimation by driver.

5. After xfer is complete in driver, driver informs the application through
fasync()

   Probably driver gets an interrupt after DMA is complete, and in the
irq_handler

   u use kill_fasync() to call the application.

 6. Application does next buffer read.



it will look like:

 for(  buff_index = i = 0; i < xfer_count; i++, buff_index =
(buff_index+1)%MAX_BUFFERS ) {

    sleep(1000);

   read( buff_fd, (mbuff +buff_index*BUFF_SIZE), BUFF_SIZE );

}



Just keep on increasing the MAX_BUFFERS depending on ur bandwidth reqment.

That should solve ur problem for high bandwidth streaming..



>So should i use SCHED_RR ?

U decide on the policy.



All the best



-nagaraj

\(*_*)/




--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           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