Im having trouble understanding offsets in computer science.
SO far i know that the segment registers work along with the offset registers like this segment_register:Offset_register. Not sure if this is right but would this be the same 0:10 where 0 is the start of a segment of memory and 10 is the ending. So there would be 10 memory blocks allocated?

Im having trouble understanding offsets in computer science.

Segment and offset registers are used to represent memory addresses that are larger than your register size. Two registers are combined to create an address that you couldn't represent using just one register.

Various CPUs do this differently. If you're talking about x86 architecture, here are some Wikipedia articles to get you started.

Not sure if this is right but would this be the same 0:10 where 0 is the start of a segment of memory and 10 is the ending. So there would be 10 memory blocks allocated?

The whole thing represents a single memory location. No blocks of memory are actually allocated--the segment and offset just tell you where to start. See the articles linked above.

Information is not clear . Please share with the details.

i dont know about this now, inform me plz

hey the segment register and offset register work this way. Lets say we have 7c0:2 the actual memory address will be 7c00+2 being 7c02. Another example is 0:7c00. The first part you shift to the left like i did 7c0 to 7c00 .but in our second case. When you shift the second part it remains zero and you just add the right portion to get where the memory starts and not how large its allocation is. Only the starting address is what you get. But on protected mode its quite different. If you want i can teach you that one as it offers more features

Remember segment:offset addresses are non-unique,
0000:7C00, 07C0:0000, 07BF:0010 form the same physical address of 07C00
A segment address is just that, the address of a segment,
it is bit extended into a 20-bit value which represents the physical
address of the first byte of the segment and the offset is
added to index into the segment just like an array of bytes, the only
difference is that the processor forms the physical address of it's
first byte for you.
Hence ARR+4 gets you the address of the fifth byte of the array.
0000:0004 gets you the physical address of the fifth byte of segment 0
The segment portion will be bit extended by appending four null bits which
is equivalent to multiplying it by 16 or bit shifting it to the left by four.
07C0:0000
becomes
07C0 << 4 =
07C00 +
0000 = 07C00
Each segment lies on a paragraph boundary, their are 65536 possible
segments which each overlap, are 64KB in length, and each one 16 bytes away
from one another in memory, .
0000:0010 beginning of segment 1, 17th byte of segment is beginning of next
0001:0010 beginning of segment 2
0002:0010 beginning of segment 3
A normalized segment offset address can be maintained by using an offset
between 0-F and incrementing the segment address to go to the next 16 bytes
in memory, allowing one to index into segments over 64KB in length.
1234:0000 - 1234:000F
1235:0000 - 1235:000F
1236:0000 - 1236:000F
Memory blocks are segments whose length in bytes are a multiple of 16
and fit into paragraphs exactly and are allocated to the program through
MS-DOS's memory management facilities, each memory block
allocated to the program by MS-DOS is preceded by a 16 byte long data structure
called an ARENA or MCB structure which is used by MS-DOS for managing memory
belonging to programs and itself. The MCB for a memory block can be found at
the returned segment address of the allocated memory block -1.
The MCB structure has the following format:
Offset Size Description

00 byte 'M' 4Dh member of a MCB chain, (not last)
'Z' 5Ah indicates last entry in MCB chain
other values cause "Memory Allocation Failure" on exit
01 word PSP segment address of MCB owner (Process Id)
possible values:
0 = free
8 = Allocated by DOS before first user pgm loaded
other = Process Id/PSP segment address of owner
03 word number of paras related to this MCB (excluding MCB)
05 11bytes reserved
08 8bytes ASCII program name, NULL terminated if less than max
length (DOS 4.x+)
10 nbytes first byte of actual allocated memory block

Hope that helps...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.