PureBytes Links
Trading Reference Links
|
Joe Stratmann wrote:
Thanks for not letting go a month old posting that noone has responded to.
> Actually Alan, a context switch does not occur by calling a function per se.
Remember the CS assembly course where we learned that a function call involves
saving all the status (register values), and returning from a function call
means to recover them? That's what I meant by "context switching". You are
talking about a higher level of context switching, at the LWP (light weight
process) level and a huge context switching at HWP (Heavy ~) level. I agree with
you on the rest of your discussion. I used DEC Profiler to look into the
microseconds consumed during a C++ function call on DEC Alpha 4100 machine and
found that a function call is very very expensive, as I put in my original
message. That's why C++ came up with the inline directive. That's the basis of
my question.
>
> But from the Operating System switching between threads. Everytime the CPU
> switches from processing one thread to another a context switch occurs.
>
> This switching can occur if a thread switches state (from waiting to ready
> for instance), a new thread is created by another (or a call to another
> thread) as well as the Operating System itself (if Windows NT based - Win2k
> included obviously) can pre-empt the the thread currently executing, if
> exceeded it's allocated time slice, and cause another thread with perhaps a
> higher priority to execute.
>
> I could be wrong on this but making function calls wouldn't cause a context
> switch unless Tradestation is written so that your functions run in thread
> different from the functions they call. Some other derivative of this can
> occur and I'm dead-tired so I hope this made sense (4.5 hours sleep...again)
> ugh
>
> Hope this helped.
>
> -Joe
>
> -----Original Message-----
> From: Alan Mi [mailto:ami@xxxxxxxxxxxxxx]
> Sent: Sunday, November 14, 1999 7:47 PM
> To: omegalist
> Subject: Cost of a Function Call in EL?
>
> In C language (C++ alike), the cost of calling a function is
> equivalent to executiing 20~40 lines of plain code (no loop,
> branch,
> calling) under typical compiler implementations, because it
> involves context switching. Is the cost of a function call
> in EL similarly high? Guess so but would like to see a sure
> answer.
>
> Alan Mi
|