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

  • SEARCH
  • Home
  • 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 108119
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T01:51:42+00:00 2026-05-11T01:51:42+00:00

My application runs on a pSOS operating system. The code is compiled with Diab

  • 0

My application runs on a pSOS operating system. The code is compiled with Diab C compiler.

The application defines a number of counters which have been declared as

unsigned int call_count; 

As there are chances of some of these overflowing in a small time frame, I have decided to declare the counters as

unsigned long long int call_count; 

This I believe would not overflow at least during my lifetime.

My question is this conversion harmless? Are there any overhead that I need to concerned with. When the application is under stress the call_count would be incremented incessantly. Can performance take a hit ? A SNMP manager would be querying these counters every 15 seconds as well.

  • 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. 2026-05-11T01:51:42+00:00Added an answer on May 11, 2026 at 1:51 am

    Is your code assuming that incrementing a 32-bit variable is an atomic operation? Incrementing a 64-bit variable on a 32-bit CPU probably won’t be atomic unless you go out of your way to make it so.

    Example:

    1. call_count equals 0x00000005FFFFFFFF when a call comes in.
    2. The lower half of call_count is incremented: call_count gets set to 0x000000500000000 and the CPU’s carry bit gets set to 1.
    3. The upper half of call_count is incremented by the carry bit: call_count gets set to 0x0000000600000000.

    If another thread or an interrupt handler reads the value of call_count between steps 2 and 3, it will get the wrong result (0x000000500000000 instead of 0x000000600000000). The solution is to synchronize access to call_count. A few possibilities:

    • Disable interrupts (if appropriate)
    • Serialize access using a lock
    • Read and write using atomic/interlocked functions (example: InterlockedIncrement() on Windows)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 71k
  • Answers 71k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer (1) When the text for error 13600 refers to the… May 11, 2026 at 1:13 pm
  • added an answer That line of code is probably optimized away by the… May 11, 2026 at 1:13 pm
  • added an answer I managed to get this response from a contact at… May 11, 2026 at 1:13 pm

Related Questions

No related questions found

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.