In c malloc will allocate some memory that can store variables. It takes in the number of bytes needed to be allocated and it gives a pointer to where the memory is allocated. What happens is that in the heap, there is a bit of space for the data, and before and after that point in the heap there are some overhead bytes that are not used for data.
Is it possible to write a function that allocates multiple blocks that can be freed separately? For example, a function which takes parameters a and b where a is a size desired and b is a pointer to an integer. The function outputs a pointer p and writes a second value to b. It then allocates 3000 blocks of memory, each of which is size a and offset by the same ammount. So at address p, there is a block of size a, at p+ 1 b, there is a block of size a, at p + 2b there is a block of size a, at p + 3 b there is a block of size a, ... and at p = 2999b there is a block of size a. Each block can be accesses separately and deallocated separately.
Ok that's actually a really stupid way to do it. What would probably be more practical is something like a function which takes the inputs a and b with a being an integer (or long) which is how many bytes you want each block, b being a pointer to an array of long integers. Then use malloc (a) to get a block the size of a, write the pointer into the array b points to, malloc (a) to get another block, write in the next part of the array, malloc (a) to get another block of size a, write the pointer of that block into array b, and so on for 3000 times to get 3000 blocks of allocated memory. But I was wondering if there was a way to do it the first way even though that would not be very good and probably burn a lot more clock cycles than a practical way.
I’ve had a theory using quantum computing to prove we can communicate with universe outside our own.
So far the theory is proven plausible, but is not established enough yet. I do think theirs a fair chance our own companies we trust are secretly developing Inter-Universe Communication through Mathematical and Quantum Coupling
I don’t know enough about this subject but I have some confidence mankind will unlock a new level of understanding.
A simple example of how this could work:
computers in both universe A and B use mathematics to bound all universes. You can apply yin-yang with a simple 1 and 0.
Universe A sends a signal using binary computing, this allows Universe B to receive the same signal.
3.Both universes would already need to be entangled through having that same signal throughout its branches. Meaning they cannot send communication that differ from each other.
4. This law applies using the computer itself (mass) which cannot leave Universe A, to the signal (Energy) to universe B. Computers are the only thing that can hold mass while delegating energy this way.
5. This must only be present, it cannot apply the same rules to the past or future. But theoretically it might be possible to bridge a parell universe using mathematics.
Last week I touched on IP Addresses, a unique address for our device allowing the data we want to receive arrive onto our device. In a similar vein is something called DNS, Domain Name System.
Think of it as... the internet's phonebook? Do the young ones even know what a phonebook is? Alas, if you don't know it was a large book with phone numbers in it, the yellow pages were businesses and the white pages were personal/residential. Anyways, that's not really the point. The point is: like a phone book connects someone's name to their phone number, DNS connects a website's domain name to its IP address.
Website have an IP address, but it's not really convenient to memorize all those numbers? And since websites can change their IP address... well, let's just say unless you had a super brain, you wouldn't be able to easily access the websites. A few maybe, like how we memorize our home phone number and maybe a few of our friends, but not all of them.
So a DNS works a bit likethis:
-->Example.com (people friendly website name, easy to remember, you know what it is and where you're going) -->DNS Lookup ( Finding the corresponding IP address ) -->12.345.678.90 ( IP address)
Step 1: You enter the website address (example.com) Your browser needs to find the server associated with the domain name.
Step 2: Your computer checks its memory Your browser or operating system may already have the IP address stored in a temporary cache. If it does, it can often skip a new DNS lookup.
Step 3: A DNS resolver looks up the address (DNS Lookup) If the answer isn't cached, your device can ask a DNS resolver, usually provided by your internet provider or a DNS service. The resolver finds the address by consulting other DNS servers if necessary.
Step 4: The IP address is returned (12.345.678.90) Your computer receives the IP address it needs to contact the website's server.
Step 5: Your browser loads the website Using the address, your browser establishes a connection, typically secures it with HTTPS, requests the webpage and displays the content.
Obviously there's more to everything, but today is just a super brief introduction to DNS. So brief, I'm not even going to dive into the cybersecurity risks. I'll just give you the summary: Yes, attackers can manipulate the DNS Lookup, and yes, there are lots of technologies designed to improve DNS security and verify the record, but ALWAY stay vigilant and check those URLS. Anyways! I'll catch ya next time!
I'm just wondering how this is done algorithmically speaking. It makes sense to just map each value to an ASCII digit, until you get to the value of 10 and above, which is something I haven't thought about until now.
I am thinking about an arbitrary precision unsigned integer in this question.
hello, does anyone know of any resources to learn computer architecture? e.g. number systems, multiplexers, cpu, logic gates, registers, ISA, opcode, boolean logic etc?
im a 1st year comp sci student undergrad and im new to this, im starting from scratch and i want to understand the terminology and how everything works.
I'm a visual learner so don't prefer books. I prefer online websites that cover everything or videos that cover everything.
I have been preparing for my interviews studying algorithms and data structures. The problems and approaches are coherent to me but the it comes to time and space complexity analysis, I'm unable to deduce it by forming relations. Do I just remember the asymptomatic notations of famous algorithms or is there any better way to learn this?
I'm sure many people have heard of an IP address, but do we all know what that really means? What they are? WHY THEY EXIST?! well... allow me...
Firstly, IP stands for internet protocol, and an IP address is a numerical address assigned to a device's network connection so that information can be sent to and from the correct destination. It's the postal address of our device, essentially. And why do we need one? Well, when we use the internet were essentially asking the networks to send us data of some sort. send us- like sending something to our home address. For example:
You're watching a YouTube video, let's say you're watching a video to learn about IP addresses.
You open YouTube on your computer.
Your computer sends a request to a YouTube server.
The server sends the video data back over the internet.
IP addresses help network equipment direct that data to the correct destination.
Without an addressing system, networks wouldn't know where to deliver information. You WOULD NOT receive the data showing you a video on IP addresses. So, YES, if you would like to recieve the data, you do indeed NEED an IP address,
Each of your individual devices has an IP address. Your phone, computer, tablet, hell even your smart TV, Alexa, baby monito r, etc.. They all have their own private IP Address. BUT interestingly, your devices share an IP address through your router, which has it's own umbrella IP address. Like the front gate address to a private community of addresses.
Now in terms of cybersecurity, I've been asked if someone could find your location using your IP address? It's a little complex but to an extent, yes. A public IP address can sometimes reveal your approximate geographic area and internet service provider. However, it generally cannot reveal your exact home address on its own. An IP address also doesn't necessarily identify one specific person, since addresses can be shared or reassigned.
However, a determined entity could use the information to further narrow down specifics. There are a few ways to make it more difficult, such as using a VPN, disabling unnecessary location permissions, avoid exposing your IP address unnecessarily, and it sounds very on the nose but be mindful of information you share. Sometimes we're out own worst enemy.
Anyways, I'll leave my tid bit here, hope you found it interesting! I'm open to suggestions on topics and people to look up, learn about, and share little snippets of what I find. Catch ya next time!
By the way, the word that pinged today was "monito r" and it violated: Rule 6: No laptop/desktop purchas e advice Rule 7: No tech/programming support. AND I just discover the word "purchas e" pings the same rules lol
I have noticed that many Computer Science undergraduate programs seem to heavily emphasise the infinitesimal calculus (Calculus I-III).
This is certainly a profound subject matter and very useful toolkit for a Computer Scientist to have.
However, I would not say that such things are greatly relevant to the actual foundations of the discipline. What is substantially more relevant is discrete mathematics, but at most institutions, discrete mathematics seems to be more of a box to check off for aspiring Computer Scientists, and a pedagogical tool to learn the Theory of Computation and Data Structures.
What is often not touched is pure logic; non-classical logic, model theory, logic and proof (semantic tableux, the sequent calculus, natural deduction), which I would wager has significantly more deeply-rooted relevance to Computer Science than any integration technique.
Notwithstanding, it seems as if a Computer Science student is vastly more likely to be able to solve a tricky Calculus problem than know much or anything about the aforementioned.
Replaced in general like completely replaced. Also do they have no influence on any post quantum cryptography, does the post quantum cryptography only take up space that they used to fill
Hello, I am very interested in learning computer graphics concepts, what are considered the best books (comprehensive or at least exploring the founding concepts)?
Since x86_64 (ig aarch64 and riscv64 too) architectures use 64-bit general-purpose registers, but current implementations limit physical and virtual addressing (e.g., to 48 or 57 bits), what engineering or physics or economics problem prevent us from building a CPU with a full 64-bit physical address space (supporting 16 EiB of RAM)?
I don't know anything about how CPUs really work so mind my stupid question.
His name is Ayo Amolewa, this is his Instagram channel and one video as an example to what he says he does, im new in computer science so is this even possible? I thought when a software is built, its code is like cyphered or something so you cant modify it. But maybe he really does so I was thinking maybe someone smarter than me knows the truth. Thank you.
Today I thought I would share what I learned about QR codes. I would say it's computer science related. Kind of. I mean, listen, obviously I focus on cybersecurity, but I'll try to stay on the more technical side. It's kind of cool.
Okay, so we all know there are little squiggly black squares that we can scan with our phones and it will take us somewhere, maybe to a website, maybe to an app, who knows the adventure you'll go on. But what really is a QR code and how does it work? QR stands for Quick Response. And the code itself is code is a type of two-dimensional barcode that stores information in a pattern of black and white squares.
How is it different from a traditional barcode? Those store information along one direction, whereas a QR code stores information across both horizontal and vertical directions.
If we understand the QR code as a tiny grid of squares, with each square helping represent information, you can kind of grasp how the two dimensions work. And thus, with the help of our handy dandy phones we can:
- Use the camera to detect the QR code. The three large squares in the corners help it identify the code's position and orientation.
- Our phone then reads the pattern. It interprets the black-and-white modules as encoded information.
- Super awesome software decodes that information. This might be a website address, text, contact details or Wi-Fi credentials.
-And finally, our phone presents the result. For example, it might offer to open a website.
All very cool stuff some far, right? AND, these tiny little squares hold a lot of information. Theoretically it can store up to 7,089 Numeric digits and 4,296 Alphanumeric characters. However, those numbers are maximum capacities under specific encoding and error-correction settings. The amount of information a real QR code can hold obviously varies.
Because I'm in cybersecurity, I'd like to briefly mention an attack called quishing, short for QR code phishing. Attackers sometimes place fraudulent QR code stickers over real ones in public places, such as parking meters or restaurant menus. Those QR codes can contain a malicious website address just as easily as a legitimate one.
The danger is where the code sends you and what you do after scanning it. For example, you scan a code expecting to pay for parking, but it directs you to a convincing fake payment website designed to steal your card details. (DAMN THEM, I'm already irritated that I have to pay for parking , now you're trying to steall all my mone y?!) I'll conclude by saying that a useful precaution is to preview the destination URL before opening it and be suspicious of stickers placed over existing QR codes.
Any whooooooo, I'll end it here. Hope you found the tid bit a little interesting. Also, should I make a list of words that ping the potential violation list? For example, we all saw the example with linu x lolololol. Surprisingly, today's word was mone y, and it violated: Rule 1: Be on-topic. (For the mods- yes, I've checked, I can not post or submit a post if I have a potential violation.)
*** This post is more about the theory of program equivalence than the results. In fact, what I want to know is if I am off-base with how everyone is *ignoring* the actual computer science of analyzing functional equivalence. If this is against the rules, please let me know. I've never posted before, and idk which reddit thread this is appropriate for. My goal is a conversation about programming languages and (de)compilers.
So obviously everyone knows about this wave of everyone decompiling software. However, these are not actual de-compilations, no? What people seem to be doing is taking the incomplete pseudo-code of Ghidra and asking these models to convert the pseudo-code into working source code. (and into Rust of all things...? Which is hardly like the original constructs of the C/C++ language that the games were originally written in). The models are getting good enough to where they can sort of make something happen.
However, the problem here is that they are not actually generating functionally equivalent programs. More specifically, there is no metric for the distance of the output program with respect to the original. You're just banking off of the pre-training of the model to (hopefully) output something decent, and then throw it in a loop.
* two things to note. Yes some people loop until they get binary equivalence. That IS a verfication. But this just seems.... silly. There's no broader statement of building an equivalence class of programs. It's brute force and randomness. The other is yes, people get fancy with the testing infrastructure. But for rendering engines, it's very hard to test the output LOOKS correct, and is the same as the original. So while this can help, I don't see how this fundamentally solves the flaw of a lack of 1:1 verification and matching behavior to the original program.
For example, I tried this with Knights of the Old Republic. Yeah, you can convince this thing to load the assets and put into into the level (after a few back and forwards with the model). But then the cutscenes don't load properly, textures are backwards, doors rotate 90 degrees rather than opening. So you go back to the model and tell it what's wrong and it (maybe) corrects. You do this over and over until you have some slice of the game working in your own codebase.
My point here is that we have the original logic. We have the answer (the x86 instructions). We know what the functional behavior is. Ghidra just doesn't output working C/C++ code, and people are asking the language models to repair it, and hope for the best. Why are we doing this? Isn't this extremely silly?
What if we had a decompiler that could output C/C++ code that worked and produced functionally equivalent (but not necessarily assembly equivalent instructions)? Wouldn't that solve most of the problem here? By what metric could we measure how similar two programs are? Is there a better way to produce a binary-equivalent program if we had a complete forward model of the underlying compiler? If we did, is that an NP-Complete graph problem? (as apposed to random permutations until the binary matches).
What research has been done to actually demonstrate functional equivalence of non-trivial programs? I understand that formal methods can put a dent into some of the more "trivial" math-like functions. But this seems insufficient for larger, more complex programs. There is much more state with respect to heap allocations, the stack, "defined behavior" that the forward compiler assumes, etc...
To speak more broadly, I am interested in the question of constructing an equivalence class of "functionally equivalent" programs. Even if it is a subset of programs in the total possible space of programs, there must be some construction where that is possible.
Someone will definitely bring up the halting problem here. To that I would say that if you can explain the termination condition, and not necessarily the decision of whether it will happen, that is sufficient. So if you had two programs which both terminate if hypothesis xyz is true, but you can't decide whether that will happen (because you don't know the truth of the hypothesis), I think that is OK. Since you can still make an assessment of how both programs behave, and that they do the same thing.
Hopefully it’s non-fiction but not necessarily needed because fiction can inspire also! Especially like you know the iPad was invented in Star Trek. The Next Generation.
Bueno actualmente estoy estudiando desarrollo de software, pero siempre tengo esa espina encima de querer ver el mundo de la computacion de forma mas general e ir indagando sobre mas temas que me interesen de la misma mientras voy descubriendo.
Siento que cuando se habla de computacion todos o almenos la mayoria pensamos que solo es hardware y sofware (piezas y pulsos electricos) pero me gustaria ver mas alla de forma matematica y teorica. Se que estos temas no son para nada sencillos pero quiero un punto de partida.
Si serían tan amables de recomendarme recursos en linea o de preferencia libros para comenzar.