r/AskComputerScience • • 23h ago

Checking my understanding about threads and parsing

2 Upvotes

Hello, after countless discussion and confusion with chatGPT and seeing multiple resources about threads (or more specifically software threads), and parsing, i finally came up with a conclusion, and just wanted to see if what i'm saying "makes sense" or if i'm missing the point.

Threads are independent flow of execution, they contain necessary information for the cpu to start or resume executing a piece of code, so they represent a flow of execution of a piece of code (they can represent many flow of executions but only one at a time) and, they also represent the current state of execution of that piece of code.

Threads are used in two scenarios (afaik):

  • To not block the concerned flow of execution : basically if a specific piece of code contains a blocking or multiple blocking tasks (or in other words instructions that times alot of time to execute), when the cpu executes these tasks/or instructions that are blocking, the entire flow of execution will be blocked, following instruction will have to wait for the current one to be finished executed by the cpu, this is a problem if the entire piece of code represents something like UI logic, where instructions have to be executed as soon and as fast as possible, for the program interface to be responsive, if the flow of execution of that piece of code that is linked to a specific thread (main thread most of the time) and, represents the UI logic, is blocked, the entire program interface will be too, so it becomes unresponsive. One of the solutions is to separate that specific flow of execution of that specific blocking part of the piece of code into a separate flow of execution represented by another thread. (another solution is using asynchorny mechanism like coroutines or generators without creating threads)
  • To improve the performance: since threads most of the time will be executed concurrently (and possibly in parallel depending on the circumstances), we can separate general tasks into smaller tasks, each task can be given to a thread to improve perforamce (well it depends, since creating more threads can be the opposite, since context switching is costly and adding more threads just adds more time for a specific thread to reach its turn to be executed)

For parsing, it's a process of analysing a group of bits according to a specific format, then extracting these necessary part of the bits and storing them into their corresponding/linked variables or data structures (sometimes these group of bits are represented in another form before they are stored???? not sure)

You may wonder why i keep over repeating stuff, i have OCD especially in "defining words" as correct as possible and to be as less confusing as possible (and also i need to spit out words in a somewhat normal pace, without pauses or else it feels like i'm just remembering the words and that's it, without understanding them), i'm a bit worried the receiver won't understand a thing and i'll be embarassed (it's like i'm just saying nonsense and it feel like i don't know a thing), and most explanations of computer science terms in general are overloaded and complicated for some unexplainable reason, and also nobody seems to be in agreement of what a term exactly means, it just doesn't help at all. (for example threads are defined as execution context or unit of execution, while this may seems understandable to some, i can assure you beginners won't get a thing from this). Anyways just wanted to metion this, i know this isn't the right subreddit to "vent" but i'll just risk it.

Anyways, just wanted to see if my explanations are delusional and incorrect or not.

Thanks for reading.


r/AskComputerScience • • 12h ago

ELI5 what is the worry about rsa potentially breaking due to AI and the rush to move to post quantum cryptography?

0 Upvotes

So there is a worry about AI breaking rsa. What is rsa and ecc ?? How will post quantum cryptography be more resistant to AI??


r/AskComputerScience • • 10h ago

Why the hell are these AI companies even trying to crack RSA and other cryptography things?

0 Upvotes

Over the past few days we have been hearing that AI might have cracked RSA and all that and its just left me wondering why.

There is nothing good that can come from it and even admitting that its probably possible if not now but in the soon future does nothing to make people think these companies are doing anything other trying to ruin things everyone. At least in my very uninformed opinion.


r/AskComputerScience • • 14h ago

Does learning actually pay off?

0 Upvotes

I'm into CS and I've been trying to teach myself theoretical computer science, but nobody really gets why I'm doing it. I'm worried I'm wasting my time and ruining my future. It's hard for me to really commit to learning because I'm actually embarrassed that I want to learn.

What should I do?