All right, my question is not sufficiently specific. I've not mentioned the kernel version, the distribution and other potentially interesting things. But, anyway... these are important but doesn't matter essentially in this crude context (what I can bear for now).

If nice value is in the interval of [-20,20), why to store it in a large space memory (actually,8 bytes)? What kind of advantage could someone/the processor take from it?

Origin of this doubt: https://www.researchgate.net/post/How_many_bytes_are_used_to_makes_the_structure_of_process_control_block_in_Assembly_language_programming_and_what_do_these_bytes_store)


  • Which eight bytes are you talking about? – Johan Myréen Jul 10 '19 at 5:32
  • in typical case, a long type is 8 bytes long. Anyway, the minimal size of a long type reserved memory is much greater than the possible patterns of one byte (actually, 8 bits :-D). Sorry but I can't understand what you really mean whith this question. – Daniel Bandeira Jul 10 '19 at 11:20
  • What 8-bit variable or field of a struct are you referring to? You have not named it. In general, there are more than the number of bytes needed to store a value to consider when choosing the data type -- memory alignment and cache line alignment. – Johan Myréen Jul 10 '19 at 11:31
  • I am reffering to NICE value used to determine PRIORITY in a schudeling process in Linux in the user space. Its values never exceeds 20. Including PRIORITY doesn't "change" too much (and boths are typed as long). Was I more clear this time? – Daniel Bandeira Jul 10 '19 at 13:32
  • The only long nice I can find in the "Reinforcement" link you provided is the parameter to set_user_nice, which is long because it is called from the syscall interface. System calls on x86_64 pass parameters in 1-6 registers, and the full 64-bit registers are used. All the other variables are of type int, like the prio, static_prio, etc fields in task_struct. int is 32 bits on x86_64. int is also the natural size in C; smaller types are expanded to int in expressions, as are function parameters, even if they are declared char. So you will have to be more specific. – Johan Myréen Jul 10 '19 at 18:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.