GZGQ.COM
welcome to my space
X
Search:  
 HOME   ThreadCreate
ThreadCreate
Published by: mike 2009-01-08
Welcome to:gzgq.com

  • Hi Every1,

    I have been given the following spec to write a ThreadCreate, I am totally lost, I only have a 2-3 days to do this. Please help.

    Thanks

    // ----------------------------------------
    // OS_ThreadCreate
    //
    // Creates a thread so it can be managed by the RTOS.
    // Threads can be created either prior to the start of
    // multithreading or by a running thread. A thread cannot
    // be created by an ISR. A thread must be written as an
    // infinite loop and must not return.
    //
    autofs-5.0.3-mount-thread-create-cond-handling::
    autofs-5.0.3 - mount thread create condition handling fix From: Ian Kent <raven@ themaw.net> Make the mount thread creation condition mutex specific to the
    http://gentoo.osuosl.org/distfiles/autofs-5.0.3-mount-thread-create-cond-handling-fix.patch
    HOME
    // Input:
    // thread is a pointer to the thread's code.
    // pData is a pointer to an optional data area used to
    // pass parameters to the thread when it is created.
    // pStack is a pointer to the thread's top-of-stack.
    // The stack is used to store local variables,
    // function parameters, return addresses, and CPU
    // registers during an interrupt.
    // priority is the thread priority. A unique priority
    // number must be assigned to each thread and the
    // lower the number, the higher the priority.
    // Output:
    // Returns one of the following error codes:
    // OS_NO_ERROR if the function was successful.
    // OS_PRIORITY_EXISTS if the requested priority already exists.
    // OS_PRIORITY_INVALID if priority is higher than OS_LOWEST_PRIORITY.
    // OS_NO_MORE_TCBS if the RTOS doesn't have any more TCBs to assign.
    NewOrder - thread: create DNS on VMware::
    4 posts - 3 authors - Last post: Sep 23features. post news. (SMS/Articles). search files, exploits & links sections:. Article Themes, Articles, Articles -> Encryption
    http://www.neworder.box.sk/forum.php?did=multWindows&thread=266300
    HOME
    Thread::Tie::Thread - create threads for tied variables - search ::
    Thread::Tie::Thread - create threads for tied variables. SYNOPSIS ^. use Thread: :Tie; # use as early as possible for maximum memory savings my $tiethread
    http://search.cpan.org/dist/Thread-Tie/lib/Thread/Tie/Thread.pm
    HOME
    // Conditions:
    // A thread cannot be created by an ISR.
    // You should not use thread priority OS_LOWEST_PRIORITY
    // because it is reserved for use by the RTOS for the idle thread.


    OS_ERROR OS_ThreadCreate(void (*thread)(void *pd), void *pData, void *pStack, UINT8 priority);


  • As i3839 stated - its hard to know what you are asking for without knowing the target RTOS...
    [9fans] procreate vs threadcreate?::
    between proccreate() and threadcreate(). are the scenario where usage of one is better than
    http://newsgroups.derkeiler.com/Archive/Comp/comp.os.plan9/2005-08/msg00225.html
    HOME
    ParameterizedThread in .NET 1.1 - Stefan Sedich's Blog::
    Nov 15, 2007 public static Thread Create<A, B>(Action2<A, B> action, A a, B b) public static Thread Create(Delegate action, params object[] args)
    http://weblogs.asp.net/stefansedich/archive/2007/11/15/parameterizedthread-in-net-1-1.aspx
    HOME

    Also - what is an ISR... Interrupt Service Register is one that comes to mind... maybe 'internal sub / system routine'... or um... ?

    Anyway, if you are using e.g. one of the real time implementations of Linux ( or another OS that supplies a full set of pthreads interfaces ) AND you can use system functions instead of completely rolling your own threading then all you would need to do is:

    * retrieves the min / max priority levels for the current scheduler via calls to sched_get_priority_min and sched_get_priority_max

    * keeps a global table of existing threads and priorities

    * validates the user provided priority is within the min / max range

    * validates the user provided priority doesn't have a conflict with the rules prior to startup

    * sets up the desired thread stack address and size via an attribute created with a call to pthread_attr_setstack

    * call pthread_setschedprio with the desired priority once the new thread is created...


    If your OS doesn't provide these functions ( or not being able to use the mysterious ISRs(?) means you have to write your provide all of the POSIX / thread style functionality 'by hand' then... a rough and very incomplete outline of what you need to do is:

    * create a thread structure to hold thread states e.g. having variables to contain the thread's function ptr, stack location pointer, stack size, current stack pointer, current code pointer, priority and so forth - these are your control blocks

    * create an interrupt style function that has a very precise (* we are talking realtime here *) calling period that is at least several cycles longer than the time required to switch from one thread structure to another i.e. sleeping one thread and starting another

    * create the time slicing etc. functions i.e. to keep track of total number of slices required according to number of threads and their priorities so you can calculate when a interrupt ( or the number of interrupts if called in fixed length time segments ) indicates a thread context switch should occur

    * a bit of assembly code to pull / modify the return address from the processor register(s) when an interrupt occurs - this is so you can save / change it on the fly and effectively 'switch' threads by ( very carefully ) changing the address...

    * a bit of assembly to handle the quirks ( platform dependent ) of doing things like modifying an interrupt return address if the code happens to be in system / kernel code at the time of the interrupt...

    * etc. etc. etc. ...

    I guess in the end... analysis is if you only have a few days and can use the first outline then no issues... if you have to write everything by hand... you are going to need a lot of caffeine, skill and luck... because its not going to be a simple task...


    Michael


  • It totally depends on your OS/kernel you're using. And as you're using some sort of real-time OS, we really don't know more than you do. It seems to be targeted for some embedded system. What you must do depends on how much the OS already can do. It seems it supports multitasking between different threads/processes, because of those priority stuff. In that case you just need to write a small wrapper that does the setup of those things, using the existing functionality.





  • Traditional University or MLM University? You Choose
    15 Questions to Ask Your Software Vendor

    You are looking at:gzgq.com's ThreadCreate, click gzgq.com to home
  • is there anyone out there who doesn 039 t eat chocolate
  • do you believe in life outside of this planet even if its one celled
  • why does good grades pull your average down in school
  • any nice quotes you know
  • your eyes are like a lake what does this mean
  • can anyone recommend a straightforward basic cookery book
  • good groomsmen gifts
  • help please can someone tell me what time it is in psd us time and pdt us time in english time at
  • what is the model that scientists use to explain what is happening when they cant see it
  • assume the density of air is constant at d 1 29 kg m3 this is not a bad assumption
  • will the hamburger still be good tomorrow
  • how many of you love like school so much
  • what stocks would be good to buy now while the stocks are low
  •  
  • can you put these in sentences 10 points
  • helppp help help please help me
  • are you secretly engaged
  • what is the appropriate wedding gift if i did not attend the wedding
  • what is the passive voice of following
  • is it good to buy an eye piece for my hand made telescope instead of making it
  • where doest this relationship stands
  • with the stock market low is now the time to invest
  • i am desperate please helpme pleasee somebody help me
  • 2d kinematics problem help please
  • borrow money to invest in stocks
  • mars trip need volunteers help
  • what is the definition for onomatopoeia
  • does anyone know a good dirt cake recipe
  •  Homepage | Add to favorites | Contact us | Exchange links | LOGIN | Site map | 
    Copyright© 2008 gzgq.com        Site made:CFZ