You can edit almost every page by Creating an account and confirming your email.

Socket (computer science)

From EverybodyWiki Bios & Wiki




A Socket, or Memory Socket, in Computer science is a fundamental abstract data type that is an array of contiguous memory addresses of bytes or words that can store an object. A socket in this context is akin to a real-world socket in the sense that the Object can "fit or revolve in" the Socket. The address space of the Socket is the Domain of the Socket. The Range of the Socket is the contiguous bytes or words that make up the Object contained in the Socket using Natural number indexes that start at Index 0. The Range is related to the Domain by a Codomain that maps memory addresses to the contiguous Object bytes or words that start at Index 0.

Linear Socket

A Linear Socket is a Socket that contains a lowest address and highest address and an Object that may grow up or down in addresses from the base address of the Object. The base address is defined as the address mapped to Index 0 of the Object. The last address is the address mapped to the highest value index in the codomain. The size of the Object can be calculated by subtracting the highest address from the lowest address and adding one.

Example:

The 32-bit Big-endian unsigned integer 1 is stored at address 100. The Range is the ordered set of bytes {1, 0, 0, 0}, where the first byte 1 is at Index 0, the second byte 0 is at Index 1, and so on. The Domain of the Socket is the ordered set {100, 101, 102, 103}. The mappings of the Codomain of the Socket is the ordered set {3, 2, 1, 0}, the order of the Big-endian Integer object bytes, with mappings {-97, -99, -101, -103} into the Domain that when added to the Domain map the Big-endian integer in the Domain to the Little-endian integer byte indexes in the Range. The object size is calculated by subtracting 100 from 103 and adding 1 to make 4 bytes. A 32-bit Little-endian unsigned integer value 1 is stored at Memory Address 104. The codomain of the Socket starting at address 104 is {0, 1, 2, 3} with mappings {-104, -105, -106, -107} into the Domain.

Circular Socket

A Circular Socket is a type of Linear Socket commonly used to create Network sockets and Inter-process communication mechanisms that contains a Circular buffer that revolves in the Socket. A Circular socket adds two additional addresses to the Linear Socket, the start address and stop address, sometimes called the end address. The start address corresponds to Index 0 in the Range of the Socket and the first byte or word of the object. The stop address differs from the last address of the Linear Socket in that it does not map to a byte in the Object in the Socket, but instead if the start and stop indexes are equal than the socket is empty and contains a null object. The start and stop addresses correspond to start and stop indexes in the codomain to allow the Circular buffer to be oriented up or down in memory addresses from the base address. When the start index is less than the stop index the Object is Contiguous, when the start index is greater than the stop index, the Object is Discontiguous or Fragmented. If a member of the Range of the Circular socket does not map to the Range, the Range element and codomain mappings are set to infinity or some invalid index.


This article "Socket (computer science)" is from Wikipedia. The list of its authors can be seen in its historical and/or the page Edithistory:Socket (computer science). Articles copied from Draft Namespace on Wikipedia could be seen on the Draft Namespace of Wikipedia and not main one.