this post was submitted on 15 Dec 2024
98 points (97.1% liked)
Asklemmy
44143 readers
1525 users here now
A loosely moderated place to ask open-ended questions
If your post meets the following criteria, it's welcome here!
- Open-ended question
- Not offensive: at this point, we do not have the bandwidth to moderate overtly political discussions. Assume best intent and be excellent to each other.
- Not regarding using or support for Lemmy: context, see the list of support communities and tools for finding communities below
- Not ad nauseam inducing: please make sure it is a question that would be new to most members
- An actual topic of discussion
Looking for support?
Looking for a community?
- Lemmyverse: community search
- sub.rehab: maps old subreddits to fediverse options, marks official as such
- !lemmy411@lemmy.ca: a community for finding communities
~Icon~ ~by~ ~@Double_A@discuss.tchncs.de~
founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
In computer programm single threaded programs are pretty predictable (apart from human errors). As soon as you have multi threading that goes out the window. Modern CPUs in most devices you use have what's called a scheduler that schedules when to let different things actually use the CPU so you can actually do multiple things at once. It's a super important concept for what we want to do with devices. But because of that you have no guarantee about when (or if) other threads of your own code will execute. Apart from truly insane edge cases, single threaded programs act pretty deterministically. Multi threaded ones do not. It's very similar to the "it's alive and dead until you check" idea because you just don't know. So much so that there are data types we use called things like Maybe where the result is either a success or a failure and you write code for both.
Also much like the cat in a box thing, programmers don't really view it as magic, it's just sort of a side effect of the uncertainty.
Is it actually non-deterministic or just too many variables and too much sensitivity to initial conditions influencing the scheduler's decisions for the programmer to reasonably be able to predict?
It is deterministic, it is just determined elsewhere.
If thread 1 is working on a task and needs the output of thread 2, it doesn't know what the output is. Of you move the tasks from thread 2 back into thread 1, then you have eliminated the point of multi threading.
Without getting philosophical, I'm going to say human behavior is non-deterministic. Because a human is using a computer you cannot reason about what may be running when. That's why I say it's non-deterministic. You can make an argument that a non real time computer not connected to the Internet could be considered fully deterministic, but it's really just a distraction. That's why I tried to make it clear I wasn't talking about "magical 'truly' random" things.
I'm not trying to get overly technical or philosophical lol. For example, PRNGs are deterministic, but it's sufficiently random that we treat it as random without worrying about whether it's "actually random." (But yes, there can be bugs where they actually are behaving too predictably and they actually aren't random. This is why I'm trying to keep the topic simple without getting lost in the details.)
Yes. It's chaotic but still deterministic.
When you account for not knowing what else is going on the system I'd say it's actually non deterministic. But not in a magical "truly random" sort of way, just that other things you don't personally have control over are going on. If this topic interests you then you may want to look into real time computing which is an area where you do have deterministic systems where you can more accurately guarantee how long something will take. This is important in dangerous activities. Think things like nuclear reactors where a process taking too long might mean not alerting another part of a system that something bad has happened. Like the part of the system that tells you if something is too hot not responding so you keep adding fuel. Compare this to your phone. If your phone is slow then, well, it's just annoying really.
At present there's only one fork on the above process. That didn't seem right to me.