Hand tearing ring queue Series II: lock free to achieve high concurrency

This article is the second in the series of hand tearing ring queue. The links to previous articles are as follows:Hand tearing ring queue The previous article introduces a basic ring queue, which can be used in multithreading, but there is one premise:At any time, there can only be one producer and one consumer. In other words, if multiple p ...

Posted by audiodef on Thu, 30 Dec 2021 05:38:46 +0100

Implementation of locks and atomic operations

Atomicity of operation Ten threads perform + + on the count variable at the same time, and each thread performs + + 100000 times. The ideal result is 1 million, but the final result is less than 1 million. #include <stdio.h> #include <unistd.h> #include <pthread.h> #define THREAD_COUNT 10 void *func(void *arg) { vol ...

Posted by Cheeseweasel on Thu, 30 Dec 2021 05:31:27 +0100

Calculator function implementation (stack)

Calculator function implementation (stack) input 15*5+(5+1)/6-7 output 69 Problem solving ideas Because priority should be considered in actual calculation, we need to establish a function. Here, I name it get (char x). X is the formula we enter, I set the priority of "(") as' 0 'at the lowest, followed by' + 'and' - 'as 1,' * ' ...

Posted by deolsabh on Wed, 29 Dec 2021 18:52:23 +0100

DialogBLE chip: OTP read / write, otphader

The BLE chip of Dialog basically has OTP (one time programmable) memory, that is, the memory written at one time. Once written, it cannot be modified. For example, DA14531 has 32KB OTP memory. It is mainly used to write curing programs and save some important factory parameters. The following mainly describes how to read and write OTP memory an ...

Posted by iii on Wed, 29 Dec 2021 16:49:51 +0100

C language homework ------ "student achievement management system" creation record

Last semester of freshman year, the C language class was almost over, and time passed quickly (although I didn't listen much in class). After talking about the pointer, the teacher assigned a big homework. Let's get a student performance management system, as shown below: Huh? C file? What is the C file? I haven't heard of it. The first feel ...

Posted by Gorf on Wed, 29 Dec 2021 08:51:46 +0100

Starting from scratch

catalogue 1. Menu interface 2.game() function 2.1 defining arrays 2.2 initialize the chessboard 2.3 print the initialization chessboard and construct the chessboard pattern 2.4 players play chess and print the board PlayerMove(board,ROW,COL) 2.5 computer playing chess and printing ComputerMove(board,ROW,COL) 2.6 judgment of winning and ...

Posted by sebastiaandraaisma on Wed, 29 Dec 2021 07:07:12 +0100

[C language] dynamic memory distribution

preface This blog post is only for me to summarize and learn the knowledge of dynamic memory allocation in C language. In the summary process, I refer to many blogs. Reference blog: https://www.cnblogs.com/ericling/p/11746972.html https://blog.csdn.net/MarcoAsensio/article/details/85937002 summary An array is a collection of a fixed n ...

Posted by CaptainChainsaw on Wed, 29 Dec 2021 04:13:47 +0100

Simple minesweeping game [C language version]

1, Game Description First, open the game interface and a minesweeping area will appear. There are three minesweeping areas to choose from. The minesweeping difficulty of each minesweeping area increases in turn Primary: 81 blocks, 10 mines (the primary version of mine sweeping is implemented here) Intermediate: 256 squares, 40 mines Advanc ...

Posted by chord on Wed, 29 Dec 2021 03:07:50 +0100

C language, structure

Look at a cat problem Mrs. Zhang has two cats: one is Xiaobai, 3 years old, white. There is also a flower named Xiaohua, 100 years old this year. Please write a program to display the cat's name, age and color when the user enters the cat's name. If the kitten name entered by the user is wrong, it will show that Mrs. Zhang does not have th ...

Posted by Zwiter on Wed, 29 Dec 2021 00:34:41 +0100

C Language Advancement - Analysis of Circular Sentences Defects

In the environment of learning materials full of sky, knowledge becomes very scattered and systematic knowledge is not much, which leads many people to work hard every day to move themselves, but ultimately have little effect, or even give up learning. My mission is to filter out a lot of invalid information, to systematize knowledge, to reach ...

Posted by Sharkadder on Tue, 28 Dec 2021 23:54:35 +0100