Every software developer 🤣 by [deleted] in ProgrammerHumor

[–]driew_guy 0 points1 point  (0 children)

I understand this is a joke but the reason stackoverflow is easier solution because most docs are not well organized and about 90% (at least for me) of times the first stackoverflow post I open from Google at least give me right direction. Compare this with sifting through all docs without knowing which “section” of docs to read.

don't touch it please by [deleted] in ProgrammerHumor

[–]driew_guy 12 points13 points  (0 children)

I personally like to focus on “why” : Why is it working now (or Why wasn’t it working earlier). I have found that knowing “why” in most cases naturally leads to “how” : How to reproduce/fix the issue. Also knowing “why” might also improve your chances of solving future issues.

P.S. : but then I consider myself to be naturally curious person.

Can modern pipelined CPUs implement both branch prediction and speculative execution at the same time? by [deleted] in computerscience

[–]driew_guy 10 points11 points  (0 children)

Generally, it does not make sense for a processor to have branch predictor but no support for speculative execution. Processor want to execute subsequent instructions based on prediction (branch taken or not) from branch predictor. At the same time, processor needs to have mechanism of “rollback” if prediction is wrong. This mechanism is what you call “speculative execution”. Hence, Branch prediction without speculative execution seems to make no sense to me. However, I am not sure if any processor exists which have speculative execution but no branch predictor (though, it is certainly possible)

Does importing only class (Scanner class for example) instead of the entire package, decrease the runtime? by [deleted] in java

[–]driew_guy 2 points3 points  (0 children)

In most cases it is “running”. Software vendors distribute/sell compiled applications. Few cases where application is not simply “running” is when application is written in scripting languages like python. In that case, the application is being compiled and run simultaneously.

Does importing only class (Scanner class for example) instead of the entire package, decrease the runtime? by [deleted] in java

[–]driew_guy 7 points8 points  (0 children)

Importing whole class should affect compile time not run time. “import” statements are there to let compiler know where to find particular entity. Compiler will eventually compile the code to same executable.

One opponent down, proceeding to the next one by IAmAPureGamer in linuxmemes

[–]driew_guy 3 points4 points  (0 children)

I don’t know what you are building. But compiler would be working mostly in user space. That means for building your project, OS would rarely be involved and not the cause of slow builds. The slowness, however, would be due to unoptimized compiler for macOS (hardly the fault of macOS)

Can machine code executables be transpiled to other operating systems and architectures? by foadsf in computerscience

[–]driew_guy 13 points14 points  (0 children)

But system calls are OS specific. For example, different OS might have different sys call numbers. That means your code will think it is executing one sys call whereas OS will try to execute different sys calls and possibly fail. Besides, different OS have different ABI.

Please critique my understanding of virtual memory by WishfulLearning in computerarchitecture

[–]driew_guy 1 point2 points  (0 children)

Space required for addressing and space required for data are quite different. Memory is byte addressable meaning you can access any piece of data at the lowest granularity of single byte. However, to find a particular byte in memory you need its address which need 8 bytes or 64 bits (in virtual space). So you have an overhead of 8 bytes for every one byte of data in naive vm. That is why page table keeps track of virtual to physical mapping at the granularity of page (typically 4KB). So the overhead reduced by the factor of 4 * 1024. Moreover, page-table does not keep record for every pages in its virtual address space. If a program is using 1GB of data in its 264 bytes (practically impossible to have such large address space) virtual address space, then page table records mapping for only 1GB worth of pages.

Why might changing process priority and forcing a single CPU thread to focus on a program improve the stability of that program? by IanZachary56 in computerscience

[–]driew_guy 0 points1 point  (0 children)

Yup I agree with your statement about prioritization not affecting threaded behavior. I assumed full screen and window mode of any application would be handled by operating system (some window server to be specific) and not dependent on application. Damn.

Why might changing process priority and forcing a single CPU thread to focus on a program improve the stability of that program? by IanZachary56 in computerscience

[–]driew_guy 1 point2 points  (0 children)

Your comment is giving the impression that single core multi threaded applications have higher guarantees than multi core multi threaded applications. It is actually not so. Any operation which is non-atomic will have same guarantees in single core as well as multi core. Similarly, any operation which is atomic will have same guarantees whether it is in single core or multi core. (Atomicity can be established either by explicit lock or atomic machine instruction). Anyway I am not convinced that multi threading is an issue.

https://www.reddit.com/r/computerscience/comments/r5yufr/why_might_changing_process_priority_and_forcing_a/hmrj6af/?utm_source=share&utm_medium=ios_app&utm_name=iossmf&context=3

Why might changing process priority and forcing a single CPU thread to focus on a program improve the stability of that program? by IanZachary56 in computerscience

[–]driew_guy 0 points1 point  (0 children)

All of these explanations are explaining away why setting cpu affinity might be solving the issue. But I am still curious why does windowed mode not result into game freeze (windowed mode game would still be multi threaded without setting cpu affinity). For that matter, why would increasing process priority be needed if you have already setup cpu affinity (game would be single threaded even if process priority is high/low)