4 billion QQ numbers, limited to 1G memory, how to deduplicate? 4 billion unsigned ints, if stored directly in memory, need: 4*4000000000 /1024/1024/1024 = 14.9G, considering that there are some repetitions, the space of 1G is basically not enough. To achieve this function, you can use a bitmap. If you use a bitmap, a number […]
Tag: memo
The essence of the cache and memory function memoize
I am participating in the “Nuggets·Starting Plan” Foreword Memory functions, that is, functions with caching capabilities. For ordinary calculation functions, more space is exchanged for time, which has certain advantages in a large number of complex calculation scenarios (long recursive or long iterative operations) Just look at an example function add(a, b) {<!– –> return […]
Linux interprocess communication – shared memory
Author: Lingmo Blog homepage: Lingmo’s blog Column: Linux system programming, file knowledge and understanding, Linux process learning… If you think the blogger wrote well, I hope everyone will keep repeating (?Follow,?Like,?Comment), please support me a lot! ! Table of Contents Shared memory principle shared memory function Shared memory related instructions Shared memory code display Shared […]
18 classic programs (including source code) that must be memorized in C language
1. C language must memorize 18 classic programs The thousands or even tens of thousands of lines of C language program codes you see are all written with some basic statements and keywords. It’s just that their logic functions are different, so how to quickly get started with C language codes, it is recommended to […]
String function + memory function
String function + memory function The previous blog has introduced most of the string functions. This blog first supplements the remaining string functions, and then mainly introduces the memory functions. 1. String function 1. strtok char * strtok ( char * str, const char * sep ); The sep parameter is a string, which defines […]
DMA data transfer & DMA+AD multi-channel—-DMA direct memory access
Define a variable on the OLED display and see that it starts with 0x2000 on the SRAM; add const before the variable to make it a constant and then check the address that starts with 0x8000 on the Flash, if there is a piece of data that does not need to be changed Large content […]
Analysis of stm32 MCU and FreeRTOS, LwIP memory stack usage
Analysis of stm32 MCU and FreeRTOS, LwIP stack memory usage As an industrial communication product R&D engineer, I often encounter the need to use middleware FreeRTOS and LwIP on the microcontroller. This article mainly sorts out the memory usage methods of various middleware, and the memory management issues that need to be paid attention to […]
What are the commands for viewing memory usage in linux
The commands include: 1. The free command can display the system memory status, including the usage of physical memory, shared memory and system cache; 2. The “cat /proc/meminfo” command can read the “/proc/meminfo” file Content, display memory usage; 3, vmstat command, can be used to monitor CPU usage, process status and other information; 4, top […]
Linux kernel: memory management – zone data structure
Undertake concepts related to memory management and explain related data structures. There are pg_data_t: represents the node; zone: memory domain; page: page frame; struct zone { /* Read-mostly fields */ unsigned long watermark[NR_WMARK]; unsigned long nr_reserved_highatomic; /* * We don’t know if the memory that we’re going to allocate will be * freeable or/and it […]
09 | Slicing cluster: the data has increased, should we add memory or instances?
I have encountered such a requirement: to use Redis to save 50 million key-value pairs, and each key-value pair is about 512B. In order to quickly deploy and provide external services, we use cloud hosts to run Redis instances. Then, the How to choose the memory capacity of the cloud host? I roughly calculated that […]