Corporate Website: www.chenzhangdata.cn
Beijing Chengzhang Data Technology Co., Ltd. was founded in 2022 and focuses on database technology. Our core team comes from top companies such as Microsoft Research Asia, VMware, Xiaomi, Baidu, Alibaba, PingCAP, Kuaishou, HP,and more.
We offer R&D internships every year. Over the past few years, students from Peking University (PKU), Beihang University (BUAA), Minzu University of China (MUC), University of Science and Technology Beijing (USTB), Beijing Institute of Technology (BIT), Beijing University of Technology (BJUT), China University of Mining and Technology (CUMT), Sun Yat-sen University (SYSU), University of Chinese Academy of Sciences (UCAS), Carnegie Mellon University (CMU), The University of Melbourne (UniMelb), and other prestigious universities have completed or are currently doing internships with us.
We are dedicated to building next-generation enterprise-grade databases with independent IP and global differentiation. Our products are based on the concept of "Data Substrate", supporting both private and public cloud deployments.
In 2025, we fully open-sourced our products. Please visit: EloqKV, EloqSQL, EloqDoc.
All three products are built on our innovative Data Substrate architecture, offering modular flexibility and high performance for AI applications.
Learn more at: www.chenzhangdata.cn
We believe in work-life balance and oppose bureaucracy. We respect facts, diversity, and gender equality.
We expect engineers to manage their time well and seek help when problems arise — not avoid them.
Please complete the concurrent array update task described in the problem statement.
Question. Given an integer array S of length N (N = 100,000), there are M (M >= 2) workers concurrently accessing and updating S. Each worker repeats the following operation 10,000 times: Generate random numbers i and j, 0 <= i, j < 100,000. Update S such that S(j) = S(i) + S(i+1) + S(i+2). If i + 1 or i + 2 is out of bounds, then use (i+1) % N or (i+2) % N. Hint: (a) Please consider concurrent protection,即reading S(i), S(i+1), S(i+2) 和updating S(j) 是原子操作。 *Refer to the two-phase locking algorithm (b) Pay attention to the lock granularity. Each worker only reads 3 elements at a time and writes 1 element. There are a total of 100,000 elements. The probability that concurrent workers access the same element is very low. Using fine-grained locks can reduce conflicts and improve concurrency. (c) Pay attention to the difference between read locks and write locks. (d) j may fall in the [i, i+2] range. (e) Additional thinking: Will deadlock occur? How to avoid?
完成后请发送至 hr@monographdb.com,我会在24小时内回复。
完成后请发送至 hr@monographdb.com,我会在24小时内回复。