Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7541629
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T07:56:37+00:00 2026-05-30T07:56:37+00:00

I have a thread, which does a function call, Thread 1() { while(1) {

  • 0

I have a thread, which does a function call,

 Thread 1()
 {
 while(1)
 {
 msg =  msgreceive();
condn= msg->condn;
 switch(condn)
 {
 case 0:
 //do sonmething
 break;
 case 1:
  printf("case_1");
  function2()
 break;
  }
}
}

function 2()
{
printf("fn2_Start");
//Do something
function 3();
printf("fn2_end");
}

fucntion3()
{
printf("fn3_Start");
//Do something
printf("fn3_end");
}

Normally i get the printf traces this way,

case_1
fn2_Start 
fn3_Start
fn3_end
fn2_end
case_1
fn2_Start 
fn3_Start
fn3_end
fn2_end
....
....
...

But some times in long run, i get the traces this way

case_1
fn2_tart
fn2_start
fn2 start
case 1
case 1

This is with embedded RTOS device environment.(MQX) Language – C
Is there anyway we can suspect why the sytem can behave this way.This happens when the system is heavily loaded running with about ~93% of memory usage.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T07:56:38+00:00Added an answer on May 30, 2026 at 7:56 am

    If the stdout stream is buffered at the device driver level and outout handled by an interrupt, then when the buffer is full, and if it is designed to simply discard characters rather than perform blocking I/O, then this will result in loss of characters in the output.

    If that is the case, then the actual execution is following the normal sequence (and Occam’s Rasor rather suggests that would be the case), but some of the trace output is simply being lost. This hypothesis is supported perhaps by the malformed fn2_tart output.

    Using “printf” as a trace method is not non-intrusive. It can both affect and be affected by the way your code runs. Increasing the buffer size may help if the high CPU load periods are relatively short, but if they are permanantly sustained, no ammount of buffering will solve the problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple class which does some calculations in its own thread and
I have a windows service which runs a separate thread with a function which
I have a thread which handles all the HTTP Connections to the server and
I have thread exception handler which saves the exception stack trace and should close
I have the main thread from which I start a window using invokeLater .
I have one std::list<> container and these threads: One writer thread which adds elements
I have a parent thread (non-UI) which creates some child threads to do some
I have a parent thread (non-UI) which creates some child threads to do some
I'm working on a thread library which implement user level threads (i have something
In my C# program, I have a thread that represents a running test, which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.