On Wed, Jan 17, 2001 at 06:55:57AM -0500, Christopher D. Carothers wrote:
> 
>       Hi all. I am still in search of a way to allow RTLinx to run a
> program to completion without giving the Linux thread and assoc.
> user-level apps a slice of either CPU on an SMP box.

See the nolinux feature and example (in examples/misc) in RTL V3.

On the other hand, if you just want to run a Linux user task to completion
and you don't want to make any system calls, you can use rtlinux_sigaction
to invoke your user code in RT mode and this code can turn off interrupts
and just run.


> 
>       I am hearing that certain hardware devices have their operation
> tied to recv'ing a while timed jiffie or other interrupt. Thus, Linux may
> not be very well behaved if it misses several 1000 or even 1,000,000s of
> jiffies -- thus, when the RTL program completes, Linux may not come back
> in a stable state. Could someone help me understand these issues. I do
> realize that I will need to mlock all the RTLinux application memory so
> that there are not application memory pages on disk that need to be
> swapped in -- w/o linux runnning the swap will never happen and the system
> will lock up -- I think :-).
> 
>       I do point out that my SMP box is stand alone and contains
> reasonable hardware devices (i.e., intel eepr 100 nic, NCR SCSI controller
> and WD 9 GB SCSI hard drive, SCSI CD-ROM), so it seems that I should not
> cause Linux that much grief by effectively turing off jiffies...
> 
>       Any insights to the above would be most appreciated.
> 
>                       Thanks!,
>                       Chris
> 
> On Tue, 9 Jan 2001, Christopher D. Carothers wrote:
> 
> >     Hi all. Below is my hacked up version of reserve_cpu.c from
> > examples/misc. I am running rtl-3.0-pre10 with Linux 2.4.0-test1. I have a
> > dual P-II, 400 Mhz, Micron system (nightshade motherboard). However, when
> > I run the code below my system hangs -- this happens even if I just
> > allocate a single CPU.
> > 
> >     My overall goal is effectively allocate all CPUs -- meaning all
> > threads are NOT periodic, thus RTLinux is not giving up a single CPU cycle
> > to Linux -- is such a thing possible? I have head this causing problems,
> > but I do not quite understand why on a stand alone system (i.e., no NFS or
> > other multimedia device are running -- just a hard disk, ram, CPU and
> > console -- that is all I need) -- I would of course like Linux to come
> > back once my multithreaded program is complete.
> > 
> >     Any help would be most appreciated.     
> > 
> >                     Thanks,
> >                     Chris
> > 
> > --------------------------------------------------------------------
> > Christopher D. Carothers
> > 
> > Assistant Professor
> > Department of Computer Science         
> > Rensselaer Polytechnic Institute
> > 110 8th Street
> > Troy, New York 12180-3590
> > 
> > e-mail: [EMAIL PROTECTED]
> > web page: www.cs.rpi.edu/~chrisc
> > phone: (518) 276-2930 
> > fax: (518) 276-4033
> > --------------------------------------------------------------------
> > 
> > #include <rtl.h>
> > #include <pthread.h>
> > 
> > #include <rtl_conf.h>
> > #ifndef CONFIG_RTL_SUSPEND_LINUX
> > #error CONFIG_RTL_SUSPEND_LINUX not enabled
> > #endif
> > 
> > pthread_t thread;
> > #define NUMBER_OF_WAITS 10000
> > #define NUMBER_OF_OUTER_ITERATIONS 500
> > #define NUMBER_OF_INNER_ITERATIONS 10000
> > 
> > volatile int start0=0;
> > volatile int start1=0;
> > 
> > void * start_routine(void *arg)
> > {
> >   int i,j;
> >   hrtime_t start;
> > 
> >   rtl_printf("RTL Reserve_cpu thread starts on cpu %d\n",
> >          hw_smp_processor_id());
> > 
> >   if( hw_smp_processor_id() == 0 )
> >     start0 = 1;
> >   else if( hw_smp_processor_id() == 1 )
> >     start1 = 1;
> >   else
> >     {
> >       rtl_printf("RTL error: invalid cpu id %d\n", hw_smp_processor_id());
> >       return 0;
> >     }
> > 
> >   //  i = 0;
> >   //  while( start0 == 0 && start1 == 0 )
> >   //    i++;
> >   
> >   rtl_printf("start RTLinux reserve_cpu demo: numcpus=%d\n",
> >          smp_num_cpus);
> >   
> >   for(j=0; j < NUMBER_OF_OUTER_ITERATIONS; j++)
> >     {
> >       for(i=0; i < NUMBER_OF_INNER_ITERATIONS; i++)
> >     {
> >       start = gethrtime();
> >       while( gethrtime() - start < 50000 )
> >         start++;
> >     }
> >       rtl_printf("RESERVE Demo: itr = %d, cpu = %d ",j, hw_smp_processor_id());
> >     }
> >   rtl_printf("RTLinux RESERVE DEMO: end numcpus=%d\n",smp_num_cpus);
> >   return 0;
> > }
> > 
> > int init_module(void) 
> > {
> >   pthread_attr_t attr;
> > 
> >   pthread_attr_init (&attr);
> >   pthread_attr_setcpu_np(&attr, 1);
> >   pthread_create (&thread, &attr, start_routine, 0);
> >   // pthread_attr_setcpu_np(&attr, 0);
> >   // return pthread_create (&thread, &attr, start_routine, 0);
> >   return 0;
> > }
> > 
> > void cleanup_module(void) 
> > {
> >   rtl_printf("RTLinux RESERVE DEMO: cleanup numcpus=%d\n",smp_num_cpus); 
> > }
> > 
> > 
> > 
> 
> -- [rtl] ---
> To unsubscribe:
> echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
> echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
> ---
> For more information on Real-Time Linux see:
> http://www.rtlinux.org/rtlinux/

-- 
---------------------------------------------------------
Victor Yodaiken 
Finite State Machine Labs: The RTLinux Company.
 www.fsmlabs.com  www.rtlinux.com

-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
---
For more information on Real-Time Linux see:
http://www.rtlinux.org/rtlinux/

Reply via email to