In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article shows you how to prove biased locks in Java concurrency. The content is concise and easy to understand, which will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.
Glibc recompile 1.1 initialization environment
Glibc version: ldd-- version
Gcc installation: yum-y install gcc
Check the openjdk version in yum: yum search java | grep-I-- color jdk
Openjdk installation: yum install-y java-1.8.0-openjdk.x86_64 java-1.8.0-openjdk-devel.x86_64
System environment version:
Yum-y install lrzsz
1.2 recompile the glibc library file 1.2.1, here is the glibc version: glibc-2.19.tar.gz
1.2.2. Decompress: tar-zxvf glibc-2.19.tar.gz
1.2.3. Find this file: / glibc-2.19/nptl/pthread_mutex_lock.c
1.2.4. Fix this file: _ _ pthread_mutex_lock this method
Fprintf (stderr, "msg tid=%lu\ n", pthread_self ())
Don't forget to add this package
# include
Any future thread calling pthread_mutex_lock () will print msg tid=123456677 (tid).
1.2.5. Overwrite pthread_mutex_lock.c
Modify permission 664-> chmod-R 664 pthread_mutex_lock.c
Execute the command:.. / configure-- prefix=/usr-- disable-profile-- enable-add-ons-- with-headers=/usr/include-- with-binutils=/usr/bin
-- disable-profile parameter: compiles the library but does not contain analysis information. Ignore this option if the temporary tool requires analysis information.
-- enable-add-ons parameter: instructs Glibc to use an additional NPTL package as the thread library.
-- the with-headers=/usr/include parameter: tells Glibc to compile itself with the header file just installed in the usr folder, which provides better optimization based on the specific features of the kernel.
-- with-binutils=/usr/bin parameter: specify the path to the Binutils program directory. This parameter is not required, but it ensures that the Binutils program will not be used incorrectly when compiling Glibc.
Some installation methods are compiled when the specified directory is not / usr, but by establishing a soft chain to point to the new libc-2.18.so version, in the process you need to delete the original connection and establish a new soft connection, but there is a big hole here, that is, when you delete libc.so.6, it will cause the system command to be unavailable.
Compilation: make
Compilation: make install
Compilation results: under test
This indicates that it has been successful. Let's take a look at the current glibc version: ldd-- version
The current version is the glibc 2.1.9 I uploaded.
1.3Extending knowledge pthread_mutex_lock.c
Int pthread_mutex_init (pthread_mutex_t * _ mutex,const pthread_mutexattr_t * _ mutexattr) creates a lock
Int pthread_mutex_destroy (pthread_mutex_t * _ mutex) destroys the lock
Int pthread_mutex_trylock (pthread_mutex_t * _ _ mutex) returns an error immediately before trying to lock,lock
Int pthread_mutex_lock (pthread_mutex_t * _ _ mutex) tries to go to lock,lock and wait forever.
The time it takes for int pthread_mutex_timedlock (pthread_mutex_t * _ restrict _ _ mutex, const struct timespec * _ restrict _ _ abstime) to wait for _ _ abstime before trying to lock,lock
Int pthread_mutex_unlock (pthread_mutex_t * _ mutex) releases a lock
Int pthread_mutexattr_init (pthread_mutexattr_t * _ attr) initializes lock parameters
Int pthread_mutexattr_destroy (pthread_mutexattr_t * _ _ attr) destroy lock parameters
Int pthread_mutexattr_setpshared (pthread_mutexattr_t * _ attr,int _ pshared) sets the process sharing properties of the lock
Int pthread_mutexattr_settype (pthread_mutexattr_t * _ _ attr, int _ _ kind) sets the lock type
The influence Policy of int pthread_mutexattr_setprotocol (pthread_mutexattr_t * _ attr,int _ protocol) setting Lock on Thread priority
See if the name of the method above is very kind, is it very similar to the inside of java j.u.c?
The above is how to prove biased locks in Java concurrency. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.