AdminDev Labs

AdminDev Labs

By Chris KennedyTechnology
Download on the App Store

All AdminDev Labs episodes

  • Race Conditions

    ## Race Conditions

    ### Definition - Two or more processes are reading or writing some shared data and the final result depends on who runs precisely when.

    ### Tanenbaum example (Printer daemon) - Process enters name of file in spooler dir - Printer daemon checks to see if file need printing - Prints and removes names from spooler dir - Spooler dir has 0 ... infinity - Two shared variables, output, point at file to be printed - in, points to free slot in spooler dir - Proc A and B queue file for printing - A reads in, stores slot 7 in variable - Clock interrupt occurs - B reads in, stores slot 7 in same variable - B writes to slot 7, updates in to slot 8 - A writes to slot 7, erasing what B put there, updates in to slot 8 - Spooler dir now in sync - B never receives output

    ### Golang example (Incrementing a counter) - Proc 1 read counter 0 - Yield thread 0 - Increment counter 1 - Proc 2 read counter 0 - Yield thread 0 - Increment counter 1 - Proc 1 write counter 1 - Proc 2 write counter 1 - Proc 1 read counter 1 - Yield thread 1 - Increment counter 2 - Proc 2 read counter 1 - Yield thread 1 - Increment counter 2

    ### Go-isms - go run -race main.go - Don't communicate by sharing memory, share memory by communicating - Passing on a channel the data structure or object.

    ### Avoiding Race Conditions - No two processes may be simultaneously inside their critical regions. - No assumptions may be made about speeds or the number of CPUs. - No process running outside its critical region may block any process. - No process should have to wait forever to enter its critical region.

    ### Mutal Exclusion - While a process is busy updating shared memory no other process will attempt to enter shared memory space. - Disabling interrupts (Single CPU) - This approach is generally unattractive because it is unwise to give user processes the power to turn off interrupts. - Lock variables - Test the lock - If 0 set to 1 - Before process can set 0 to 1, another process reads as 0 - The race now occurs if the second process modifies the lock just after the first process has finished its second check. - Busy Waiting - It should usually be avoided, since it wastes CPU time - Mutual Exclusion Algorithm: G. L. Peterson - Each process calls enter\_region - Wait, if necessary, until safe to enter shared memory region - Process calls leave\_region after done with shared memory

    ``` #define FALSE 0 #define TRUE 1 #define N 2 / * number of processes * / int turn; / * whose turn is it? * / int interested[N]; / * all values initially 0 (FALSE) * /

    void enter region(int process); / * process is 0 or 1 * / {

    int other; / * number of the other process * /

    other = 1 − process; / * the opposite of process * / interested[process] = TRUE; / * show that you are interested * / turn = process; / * set flag * / while (turn == process && interested[other] == TRUE) / * null statement * / ; }

    void leave region(int process) / * process: who is leaving * / { interested[process] = FALSE; / * indicate departure from critical region * / } ```

    18 min
  • Career Change with Lionel

    Today I have the great pleasure of speaking with Lionel, a systems engineer with an incredible story about changing his career from a dead end job into the hustle and bustle of systems and software.

    Next episode I am going to dive into what I've been learning about threads and race conditions.

    ### Introducing Lionel - Systems Engineer - Ops, Dev, DBA - Management side, day to day, how he got to where he is, biggest challenge

    ### Threads and Race Conditions - Sneak peak into next episode - Golang tool - Functional Programming - Testing vs Design

    ### Lionel Interview - Who are you - What do you do

    ### How did you get here? - Your pressing situation - Cranking out certs - Getting the job

    ### Tech Enthusiast - Favorite technology stack - What interests you - What motivates you - Favorite part of your job

    ### Current Project

    ### Future and Biggest Challenge

    ### Shout out to Josh Duffney and Hayden Barnes

    38 min
  • GNU/Journey Continues

    # Processes Continued - Lacking Thread Safety - Threads Share Resources - Processes Share Access - Concurrency and Parallelism on Multicore CPU - The Cost of Processes - Why use processes over threads?   - Safety (again)   - Isolation (processes under different users)   - Better Memory Utilization with Low Memory Machines   - Swapping is More Effective   - Servicing (stopping, suspending, restarting other processes)   - Distributed Computing

    # Applications - Apache - Google Chrome

    # Current Projects - Desktop migration - Game engine development - Forum architecture

    # Links 2D Game Engine Development on Linux https://www.udemy.com/course/cpp-2d-game-engine/

     

    22 min
  • man fork

    ## Linux Centric, Processes, and Kernel Developers

    ### Changing Directions - Why "Linux"?   - Interests change over time   - Something I've consistently gone back to   - My job and career   - Can't stay away - Not a Revamp or a Refactor - Continuing with same format   - Not a news show   - Video is on hold   - Random raw VLOG/videos

    ### Process - What is a process?   - Instance of a program running   - CPU instruction - What is a program?   - File with information on how to construct a process   - Binary format identification (metadata) format of executable   - Machine-language instruction   - Entry point address, where should the program execution being?   - Data   - Symbols and relocation tables, locations and names of functions, objects, debug   - Shared-library and dynamic-linking information, lists of shared libraries needed at runtime - Types of processes   - User initiated, interactive   - Background, daemon, automated - Daemon   - Online with the system   - Haunt you forever, never die   - User can interface with daemons

    ### Linux Process - Parent/Child   - Child process: Existing process copies itself in memory   - New PID for child, but runs concurrently with the program on execution   - fork()   - Both processes continue with the next instruction   - Child has access to file, CPU registers, and I/O that parent has access to   - PID and PPID are used to identify and keep track of processes   - man page: The child process and the parent process run in  separate memory spaces. At the time of fork() both memory spaces have the same content. Memory writes, file mappings (mmap(2)), and unmappings (munmap(2)) performed by one of the processes do not affect the other.   - Source code coming

    ### Better tools for kernel developers - Reliance on e-mail for Linux kernel maintainers - Process is daunting to newcomers - Tooling to assist   - 500 lines of Python   - Provide message ID for email in a thread of interest   - Entire thread downloaded and stored in local mbox file - Change in the process   - Reading email threads   - Organizing patches   - Applying tags - Hesitance/resistance to change - Do developer workflows need to change?   - Why?   - Learn a newcomer vs ask for input   - Linux kernel is great as is

    25 min
  • You Down with GCC? (Yeah You Know Me)

    ### C++17 - Building GCC for C++17 - 16 threads ~20 minutes - Managing libraries

    ### It's a Bug, Not a Feature - Execution - TBB -- C++ template library - Parallel Algorithms

    ### Multiple Versioning - First time for everything - lib64 vs lib - Makefile - Linking the library directory

    ### C++ Crash Course by Lospinoso - Excellent modern programming book - Covers computer science topics - Details into REAL programming   - Networking   - Concurrency and Parallelism   - Filesystems   - Testing   - C++ Algorithms - Parallel Sort   - 1 billion random vectors   - sort sequentially   - sort in parallel   - Boom, roasted

    ### Concurrency vs Parallelism - Concurrency   - Two or more tasks in a time frame   - Scheduling via the OS to send instructions to each task - Parallelism   - Two or more tasks executing at the same time   - Scheduling has threads executing at the same time   - Race conditions

    ### BUT WHY?! - Forum Architecture   - .NET Core   - JavaScript   - Ruuuuuuby - Deeper understanding - Systems programming

     

    24 min
  • Linux Gaming Epilogue

    What's up everyone, today I am "wrapping up" the talk on Linux gaming. I need to correct the record on a few things and share my continued success with Elder Scrolls Online! Plus, some Linux feedback, news, and a PSA on encryption

    Linux Gaming Epilogue - DXVK - Wine - Lutris

    Linux Fun - Debian Bullseye - Proxmox - Current Distributions

    Linux News (???) - Ubuntu 20.04 - Wine 5

    Encryption - More of a PSA - STORY TIME - dm-crypt - Encryption on Arch Linux - Encryption on Ubuntu

    https://wiki.archlinux.org/index.php/Dm-crypt/Encrypting_an_entire_system#LUKS_on_a_partition https://help.ubuntu.com/community/Full_Disk_Encryption_Howto_2019 https://en.wikipedia.org/wiki/Dm-crypt

    28 min
  • Gaming on Linux

    Today I talk about my experiences long ago and recent about gaming on Linux, my impressions of the Ubuntu Cinnamon Remix, and the plans for the Computer Science series.

    ##Gaming on Linux

    ### The Bad - Tedious - Lot of moving pieces (Wine? Lutris? Proton?) - Misrepresenting what it is - Still needs some work

    ### The Good - Surprisingly well done (Lutris) - With proper graphics settings and game settings, "it just works!" - Error reporting - Audio

    ## Ubuntu Cinnamon Remix - Really wanted to love it - Blank and bare - Weird graphics anomalies

    ## Computer Science Series Update - Learnin' myself - Playing with C - Data types and variables - Arrays - Decision - Loops - Functions - Pointers - IO/Reading/Writing - Abstract Data Types (some C++ AWW YEAH)

    ### Post Basics - Linux memory - Linux processes - Multithreading - Filesystems - OS design and development

    24 min
  • WSL with Hayden Barnes

    Today I had the privilege of speaking with Hayden Barnes, a developer advocate for Ubuntu at Canonical. Hayden is known as the Microsoft guy at a Linux company, he founded Pengwin - a WSL distribution, and previously worked as an attorney.

     

    - From Law to Linux - Getting into systems programming - Working at Canonical - What is WSL? - WSL compared to WSL2 - Upstream from project to WSL - Future of WSL - Canonical's involvement - Skills for the job - Proudest project - Toughest challenge - Life outside of tech

    More on WSL 2: https://www.youtube.com/watch?v=lwhMThePdIo https://docs.microsoft.com/en-us/archive/blogs/wsl/pico-process-overview

    WSLConf: https://www.wslconf.dev/

    More on Hayden: https://boxofcables.dev @unixterminal on Twitter

    37 min
  • 2020

    COMPLAINS ABOUT NEW YEARS RESOLUTION DOES EPISODE ON NEW YEARS RESOLUTION

    Things to learn in 2020 - Containers - Programming Language - Editor - Shell - Networking   -- DNS   -- Routing   -- TCP/IP - Linux - Security   -- Auditing   -- Hardening  - - Vulnerability and Risk - Participate in a Meetup - Hackathon

    25 min
  • Linux Mint 19.2 Review

    Today I installed Linux Mint because someone challenged my good sensibility.

    Install process was smooth. I was able to play Dark Souls III on Linux for the first time (git gud, scrub). Installed a few tools, KVM, and played with some themes and settings.

    Probably gonna stick around for a while!

    16 min