Skip to main content

Questions tagged [memory-allocation]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
121 views

RAM architecture vs. CPU architecture

I have learned that initially PCs had 8-bit memory architecture and that 1 byte (i.e. 8 bits) was the "basic" memory unit because 8 bits was exactly the memory space required to encode any ...
Jan Stuller's user avatar
2 votes
1 answer
42 views

Problem with cache and memory from university class

In my university class, I received this homework assignment on computer architecture, but I don't know how to solve it. I already know that the correct answer is 0, but I don't understand why. Could ...
H0t_blue_B0i's user avatar
1 vote
2 answers
38 views

strip packing problem with fixed x-coordinate

Similar to the classic 2D strip packing problem, we want to put N blocks into a 2d strip and minimize the height of the strip. Each block has to be put at the fixed x-coordinate. The width and height ...
Xiaotian Hu's user avatar
0 votes
0 answers
19 views

Data structure for arguments in Arrow functions in JS

As per the rules of JS, Arrow functions don't have an argument Object, like a regular function inside JS. But it is also true, that we can pass arguments to the <...
Karan Bakshi's user avatar
0 votes
2 answers
143 views

How does a CPU jump to a instruction thats no longer in ram?

Im designing my own CPU but I don't know how it jumps to an instruction that's no longer in ram. People have told me it puts the address in the SSD but for example, if the address were 3 in ram it ...
Thenboy's user avatar
  • 11
0 votes
1 answer
57 views

Memory allocation algorithm over a growing storage

I am going to story data in a growable persistent storage. I need to implement allocation/deallocation (like malloc/free and possibly realloc but in Rust) of continuous regions of memory on this ...
porton's user avatar
  • 493
-1 votes
3 answers
2k views

Why does a 32 bit address only contain 1 byte, when 32 bits = 4 bytes?

I am really confused about it. I think 32 bits = 4 bytes but 32 bit address is only 1 bit.
ABC's user avatar
  • 11
0 votes
2 answers
53 views

Does the computer change the content of the virtual adress

My book(digital design and computer architecture ARM edition) explains loads and stores like this: To perform a load or store, the processor must first translate the virtual adress to a physical ...
user394334's user avatar
0 votes
2 answers
156 views

Are variables stored again in RAM?

Assuming this set of instructions: declare variable 'A' which has value 5 declare variable 'B' which has value 2 From what I've understood, those instructions are loaded into RAM an then read by CPU,...
Marshall's user avatar
3 votes
1 answer
597 views

Buddy system allocator and slab allocator in Linux kernel

In the Silberschatz's book "operating systems" the author talks about the allocation of memory via system buddy and slab. My first question is: in the book, both memory allocation methods ...
Bender's user avatar
  • 367
0 votes
1 answer
57 views

Bitvector for Memory Allocation

Lets say a system has 1TB of memory and 4kB blocks. How many MB of memory do we need if we want to store a bitvector to represent the current memory allocation situation with a bitvector? Bitvector: a ...
Aris Konstantinidis's user avatar
1 vote
2 answers
123 views

Realistic model of memory allocation/deallocation cost

When doing complexity analysis, they never account for the costs of memory allocation/deallocation on the heap. In particular, this is the case for the announced complexities of the operations on ...
user avatar
1 vote
2 answers
119 views

How can I write 2^65 on my 64-bit computer?

This is possibly a very trivial question for this site. If I have a 64-bit laptop that means 2^64 combinations in total are possible. But I can even get $2^{(x>>>64)}$ on my laptop. Now, it ...
Lost's user avatar
  • 113
0 votes
1 answer
86 views

Can Operating system allocate a page of process to any free frame in memory?

Consider I have a user program of 6 pages and 4 byte page size. Now my memory has 300 frames out of which 10 frames are free for allocation. Can the OS allocate page 1 of the given process to any of ...
Owl0223's user avatar
1 vote
1 answer
281 views

Difference between Caching and Slab Allocator

I've seen the term caching allocator and slab allocator used in discussions about allocation strategies, and would like to understand the difference between them. I can see some resources on slab ...
RandomCSQuestionAsker's user avatar
2 votes
1 answer
164 views

Words in computer's memory

I don't know much about memory. Here are some lines from CLRS: The words in a computer memory are typically addressed by integers from 0 to $M - 1$, where $M$ is a suitably large integer. In many ...
Emad's user avatar
  • 411
1 vote
1 answer
1k views

Memory Address Lines

I am reading a text book by David Tarnoff and there is something I do not understand, the section is on CPU and memory. The book states that the number of address lines going into a memory device ...
berimbolo's user avatar
  • 115
0 votes
0 answers
55 views

How do you work out the segmentation table, offset and frame size in segmented memory management?

If I had a process, 1, which has the following segments: Segment 1 - 50 bytes Segment 2 - 200 bytes Segment 3 - 90 bytes and I know that the total bytes in memory is 1024, how do I work out the offset/...
Anthony's user avatar
2 votes
1 answer
181 views

Constant-time adding an element?

Is a computer with infinite memory and infinite word size a Turing machine equivalent (in the sense that polynomial time remains polynomial time and exponential time remains exponential time) if we ...
porton's user avatar
  • 493
0 votes
1 answer
705 views

Number of hardware page tables and page directories kept in the MMU

How many hardware page tables (physical) and page directories are kept in the memory management unit? If a cpu has a 32 bit virtual address, the upper 10 bits are used for the page directory, the ...
Road's user avatar
  • 41
2 votes
2 answers
821 views

How are programs split up into pages in Memory Paging?

I am a bit confused about how the logical addresses are generated in a paging memory architecture and where and when a program is split up into pages. I understand how logical addresses are translated ...
Kartheyan's user avatar
0 votes
0 answers
57 views

memory management - interview question

I was asked the following question in an interview and I don't understand what is the best solution for it - Assume you have an application that needs memory. It asks for a program for this memory, 20 ...
tas1's user avatar
  • 51
0 votes
0 answers
17 views

Can I have 2 free adjacent nodes in the fit algorithm for data management

so I know we can have 2 busy adjacent nodes for the fit algo since there'll always be free memory available, but what about when it comes to 2 free adjacent nodes? Is it possible to have 2 adjacent ...
Angelic Demonic's user avatar
5 votes
2 answers
2k views

What course in CS deals with the study of RAM, CPU, Storage?

I watched the Crash Course playlist of Computer Science. It was teaching about RAM, CPU, Storage etc but I felt it was way too fast and only people who have studied the course first hand understood it ...
Rifat's user avatar
  • 59
0 votes
2 answers
157 views

Storage in registers

Whenever CPU needs the data, it gives the address of that word to the RAM via bus, then the RAM generated the copy of that word and sends to the registers via bus. Why can't the RAM send the original ...
vinter's user avatar
  • 119
0 votes
0 answers
74 views

Concurrent Garbage-Collectiong/Compacting Memory Allocator

I'm developing an algorithm for concurrent heap garbage collection/compaction. It will be used in low latency systems that need to scale well to a lot of clients, e.g. web servers. I thought about an ...
thebear8's user avatar
  • 101
0 votes
0 answers
147 views

Unbanked access, banked access and common memory access

What are they and what are their differences? Unbanked access Banked access Common memory access [EDIT] This question is originated from my reading of MPLAB XC8 PIC Assembler User's Guide where the ...
KMC's user avatar
  • 101
0 votes
1 answer
1k views

How much space an ascii character really takes on a 64 bit word addressable memory?

I know that an ASCII character needs 1 byte of memory for storage, but if a computer uses a 64-bit word addressable memory does it mean that the character actually takes 8 bytes even when only 1 byte ...
Yuvraj Singh Jadon's user avatar
1 vote
1 answer
387 views

How does computer memory store the file name?

I have this doubt for long time. When i save a notepad file, it takes the memory for the information in the file. let's say, I type 'ABC' in notepad and saved the filename as stack, it shows that the ...
Shane Studio's user avatar
0 votes
2 answers
298 views

Understanding memory leaks in C/C++ [closed]

I was looking at an example here: https://blog.parasoft.com/finding-memory-leaks-in-c ...
x89's user avatar
  • 167
3 votes
4 answers
9k views

Determine page number and offsets for address references

I'm working on learning operating systems and I've come across a strange question that I don't know how to answer. The question is: Assuming a 1-KB page size, what are the page numbers and offsets ...
TeaDrinker's user avatar
0 votes
1 answer
77 views

Memory Addressing - Alignment Clarification

I'm reading "Computer Architecture A Quantitative Approach" (5th edition) and I'm having a hard time understing this table: I understand how Misalignment happens, i.e., some byte, half-word, word, or ...
KetDog's user avatar
  • 157
1 vote
4 answers
3k views

The maximum decimal integer that can be stored in memory of 8-bit word processor computer?

Actually i am preparing for an exam and in the last year exam this que. was been asked. i.e The maximum decimal integer number that can be stored in memory of 8-bit word processor computer ? a)...
harry's user avatar
  • 13
2 votes
2 answers
53 views

Can the same machine word sometimes be data and sometimes be code?

I have a question about machine words. We have data and a code segment in the memory which is addressed. If we take a word from it and let's say it is a code (instruction), and another one is some ...
user avatar
2 votes
1 answer
104 views

How big is the capacity of a standard memory cell that the pointer is linking to?

Often programming language lectures and references have an illustration of computer memory as an array composed of individual cells. Each cell has an address, which is effectively the pointer and can ...
A.L. Verminburger's user avatar
1 vote
2 answers
417 views

Is call stack compile time or runtime detail?

I'm sorry if the question is quite naive, but I don't understand if a call stack is a language implementation detail or it depends on OS? What I'm trying to understand is what decides how to store ...
E. Shcherbo's user avatar
0 votes
1 answer
27 views

Recursive Call Inside Argument List (C++) [closed]

So, my professor asked me to implement recursion in different ways to compute $a^n$ (a and n being integers) and rank them according to their space efficiency. Now, here is one of the methods I came ...
user avatar
3 votes
0 answers
36 views

Rearrange items in order reduce fragmentation and reduce wasted space

I have a segment with some offsets at irregular intervals There are items of various length inside. Items cannot be placed randomly. Instead, their left side must match some offset. Items are free ...
Elia Perantoni's user avatar
0 votes
1 answer
319 views

Distinction between paging and segmentation?

In my operating systems textbook, there is a paragraph which states: As for the contents of each PTE, we have a number of different bits in there worth understanding at some level. A valid bit is ...
Cole Bisaccia's user avatar
-2 votes
1 answer
746 views

Converting physical address to logical

In 8-bit address space there are 16 pages and the page table stores: 68792EA51BD3CF04 (hex) The physical address is 39h, what is the corresponding logical address? I have literally no idea what to ...
Shuubi's user avatar
  • 1
2 votes
1 answer
649 views

Is it theoretically possible to dynamically grow array size in stack memory?

I was wondering, given the usual stack memory functioning, whether it is possible for an array like primitive type allowed to grow in size to exist. The functioning of such primitive type is as ...
Andrea Nardi's user avatar
1 vote
1 answer
132 views

How does dynamic memory-allocation exactly work?

I have wondered about ordinary code. Assume we are running this code on any modern System like Unix/Linux/Mac/Windows. This code is C, but it should work with every language which is close to the ...
TVSuchty's user avatar
  • 287
0 votes
2 answers
219 views

How does the memory of a 64bit and 32bit processor work

In this article, the author states that a 64bit processor can theoretically reference 2^64 bytes of memory. What does he mean by this statement, or rather the word, reference? Also, I visualize the ...
penguin99's user avatar
  • 303
0 votes
0 answers
18 views

Memory interfacing problem [duplicate]

I've learnt that the memory interfacing problem is used when we need to connect a memory that has lesser number of locations to a processor that has more address lines. For eg. Connecting memory chips ...
penguin99's user avatar
  • 303
1 vote
2 answers
143 views

Random access memory and data

What kind of data is stored in the RAM when it is fresh out of manufacture? Apart from certain basic instructions (if yes, what are they), are there numbers stored as well or are most of the memory ...
penguin99's user avatar
  • 303
1 vote
0 answers
27 views

Addresses with no memory allocated

I've read that a program can crash if it tries to access addresses with no memory allocated. But, how is it possible that an address has no memory allocated? When does it happen?
Jhdoe's user avatar
  • 133
0 votes
3 answers
409 views

How does a computer remember the address of a data variable in a program, in the main memory?

Suppose I write a program as below: int main() { int a = 3; int b = 4; return 0; } Suppose the computer stores the address of 'a' as 0x00104. How does it ...
qwerty_uiop's user avatar
2 votes
1 answer
506 views

Binary trees and preallocated nodes

I want to design a binary tree with preallocated nodes, in order to avoid calling malloc/free every time I want to insert/delete a node. The problem is I don't know ahead of time how many nodes the ...
vibe's user avatar
  • 208
4 votes
2 answers
41k views

How is the formula for calculation in row/column major obtained?

In my book, this formula is given for calculation of address of row major order's element $[I,J]$: Address of $[I,J]$th element in row major order $= B + W[n(I-L_r)+ [J-L_c]]$ where B denotes base ...
Archer's user avatar
  • 175
1 vote
1 answer
195 views

Allocating memory via Buddy Allocation

I'm trying to learn buddy allocation and whilst I think I understand the basics of it, there is one problem exercise with which I'm struggling with. So I have an 8K block and I'm using buddy ...
E. Kruminis's user avatar