eszotec
eszotec
  • 17
  • 3 353
Generating controlled load on Linux CPU cores using just C!
Hi,
in this video we are going to discus an approach to generate controlled load on all or selected CPU cores present in our Linux system and then implement a tiny C program/tool to actually do it. Here by load I mean CPU utilization that is the CPU utilization percentages we see per core when we run htop in our terminal. Also by controlled I mean we will try to generate a specific load percentage for a given amount of time. For example something like 60% cpu utilization for all or some of the cores for lets say 30 seconds.
In reality we already have a very popular tool called stress-ng to achieve the same thing however I wanted to find out how we can generate such controlled CPU load from scratch and hence thought of implementing something similar.
Some of the interesting things we will be discussing in this video are the sysconf API which lets us query system parameters at runtime, the gettimeofday API in C which let us get precision timestamp, the nanosleep API and the awesome sched_setaffinity system call which allows us to pin process to a particular CPU core in Linux.
Hope you will like this video and also do let me know in the comments what approach you would have taken to generate such CPU load in Linux.
Timestamps:
0:00 Introduction and what we plan to do
4:18 Some basic stuff
7:43 Our approach
16:39 Implementing load generation
40:39 Testing our program
43:51 CPU pinning
Code:
github.com/djmgit/cpuloadgen
Asset:
Image by Michael Schwarzenberger from Pixabay
Resources:
qxf2.com/blog/generate-cpu-load/
Advanced Linux Programming by Mark Mitchell, Jeffrey Oldham,
and Alex Samuel
#cprogramming #linux #kernel #linuxkernel #cpu #processor #programming #systems #stress #cpustress #cpuload #coding #systemcalls #devops #sre
มุมมอง: 382

วีดีโอ

I implemented the classic bricks game for my handheld game console from scratch !!
มุมมอง 5621 วันที่ผ่านมา
Hi everyone! In this video I will be implementing the classic bricks aka breakout game from scratch for Monoretro, my handheld game console that I have been building over last several weeks. I have tried to keep it as simple as possible. Hope you all enjoy! PS: Apologies for the poor audio quality in the beginning Timestamps: 0:00 Introduction 0:40 Creating the bricks 20:18 Adding the paddle an...
What is STUN? How does NAT work? Lets create a STUN client from scratch!
มุมมอง 61หลายเดือนก่อน
Hi everyone! In this video I will be discussing about something that is pretty popular in the world of computer networking: Network Address Translation or NAT. We will try to understand how NAT works, why its so important, what are the problems with NAT and how some of those problems are solved by the STUN protocol. STUN stands for Session Traversal Utilities for NAT and its a pretty interestin...
Simulating Conway's Game of Life in C using Raylib (No talking)
มุมมอง 772 หลายเดือนก่อน
Hi everyone, in this video I will be simulating Conway's game of life from scratch in C using Raylib. I will be using a 32 * 64 grid of squares which be our world. Conway's Game of life is a cellular automation designed by John Horton Conway in 1970. It consists of a infinite two dimensional grid of squares. Each state of the game or world is generated using its previous state. The simulation i...
Calling a Linux system call without using libc! How does user space call kernel routines?
มุมมอง 1152 หลายเดือนก่อน
Hi everyone! In this video we will try to call a system call in Linux without using libc! In doing so we will try to understand how the libc library functions call kernel routines, what is the System V application binary interface and how does the ABI support system calls under Linux. Timestamps: 0:00 Introduction 0:25 What are system calls? 4:58 The System V abi 7:16 ABI for system calls 14:21...
Understanding lights, light sources and surfaces by adding them to my Raytracer!
มุมมอง 493 หลายเดือนก่อน
In our previous video we discussed about the very basics of Raytracing like the 3d coordinate system, the view port, scene to canvas mapping, very basic rendering of our scene to our canvas, representing light rays using vectors, intersection of light rays to the objects in the scene etc. In this video we will add light sources to our scene and try to understand how the light coming from those ...
Zombies, Orphans, Subreaper.....What are these in Linux? Lets try to understand them!
มุมมอง 563 หลายเดือนก่อน
Hi everyone! In this video we are going to discuss some very interesting and important concepts related to process and their lifecycle under Linux and watch them in action. We will discuss about topics like what are zombie processes, orphaned processes and what is a sub reaper and its role in Linux. Have you ever wondered....... What happens when a process dies? When do they become zombie? Are ...
How does Ray Tracing work? Lets understand by implementing it from scratch!
มุมมอง 1794 หลายเดือนก่อน
Ray Tracing is one of the most popular algorithms right now for rendering realistic 3D graphics on screen. Its usage has received further boost after recent advancement in GPUs. But how does Ray tracing work? In this Video we will try to understand its internals by rendering a very simple scene using Ray tracing from scratch. Since covering Ray tracing completely in a single video is next to im...
Monoretro: Part 3 - Space invaders: Spawning bullets, shooting enemies
มุมมอง 254 หลายเดือนก่อน
Hello everyone!! This is the third video of a series where I am building a simple handheld gaming console on which we will be able to play simple version of space invader and pong. In the last video we got started with creating space invaders. We can now draw sprites on our display, we have our player which is the tank and our enemies/aliens ready. In this video we will add the ability to shoot...
Monoretro: A simple handheld gaming console prototype #shorts
มุมมอง 615 หลายเดือนก่อน
Hi, everyone Presenting Monoretro, a simple, crude, monochrome handheld gaming console prototype, built completely from scratch. The idea was to have lots of fun while building and now I want to share this with all of you. Monoretro series part-1: th-cam.com/video/bJ73T-Drf1M/w-d-xo.html Monoretro series part-2: th-cam.com/video/ZAgjvqYTwk4/w-d-xo.html Assets used: Music track: Bread by Lukremb...
Monoretro: Part 2 - Space invaders: using bitmaps, drawing sprites, Tank and Alien movement
มุมมอง 655 หลายเดือนก่อน
Hello everyone!! This is the second video of a series where I am building a simple handheld gaming console on which we will be able to play simple version of space invader and pong. In the last video we discussed about the basic setup, the hardware components, how to interface with the display and we created a simple game object on the screen which we were able to control with the buttons. In t...
Monoretro: Lets create a handheld gaming console from scratch - Part 1
มุมมอง 1025 หลายเดือนก่อน
Hello everyone!! This is the first video of a series where I will be creating a simple handheld gaming console on which we will be able to play simple version of space invader and pong. The idea is to keep it as simple as possible, low cost and have lots of fun in the process. In this video I will be going over things like what are the components we will be requiring, the environment we will be...
How do containers on linux work? Lets make one from scratch!
มุมมอง 2907 หลายเดือนก่อน
Containers have become intensely popular when it comes to software deployment, testing and shipping, both in cloud environments and on bare metal systems. Although they are not always a direct replacement for traditional virtualization but they come with several benefits over the same. Setting up and running a container on Linux is pretty easy with so many options available now, one of the most...
Process creation in Linux with C: is it fork or is it clone?
มุมมอง 10710 หลายเดือนก่อน
Hi, In this video I am going to discuss how to create processes in Linux with C. We will explore the famous fork function provided by th GNIU C library and what happens behind the scenes when we execute fork. We will also look at the Clone library and system call and the advantages it provides. #linux #fork #clone #processes #kernel #systems #C #programming #gnu #glibc Timecodes 0:00 - Intro 1:...
Building Raylib projects on Linux and MacOS
มุมมอง 35311 หลายเดือนก่อน
Hello there! In this video I have tried to come up with a Raylib build template using a GNU Make that can be used to build Raylib projects on both Linux and MacOS. I have explained: - How to build and install Raylib on Linux and MacOS - How to use a common Makefile for building Raylib projects on both Linux and MacOS. - A minimal project structure to get started with building projects in Raylib...
Voxel Space rendering with Raylib and C
มุมมอง 1.3K11 หลายเดือนก่อน
Voxel Space rendering with Raylib and C
Rendering random worlds with raycasting
มุมมอง 62ปีที่แล้ว
Rendering random worlds with raycasting

ความคิดเห็น

  • @grandmastergyorogyoro532
    @grandmastergyorogyoro532 2 วันที่ผ่านมา

    Nice!

  • @susmitamaitra2373
    @susmitamaitra2373 หลายเดือนก่อน

    A very good practical implementation of the LPI material.

  • @MasterA6858
    @MasterA6858 2 หลายเดือนก่อน

    Wish you would have explained how deltax and deltay equation got deducted.

  • @harshsuryavanshi1193
    @harshsuryavanshi1193 2 หลายเดือนก่อน

    This is a good refresher and in very detail. Thanks for creating this video. This is much better than a lot of videos out there to learn the concept of system calls. One thing I liked was you did not waste time in unnecessary details or stories or history.

  • @cybernit3
    @cybernit3 2 หลายเดือนก่อน

    I wish Raylib allowed for Vulkan, and more mod tracker formats than just mod and xm. It is weird I used golang and raylib to do the basic raylib example and the raylib windows opens on my primary screen. Then I use C and raylib window opens on my secondary monitor; do you know how to fix this? I use Ubuntu 24.04 LTS and Gnome 46 (wayland). I even compile with wayland flags set. Nice to see you use raylib for other than game programming. I also tried SDL3 out and got it to work, but had to compile SDL3, there is no binary release yet.

  • @susmitamaitra2373
    @susmitamaitra2373 3 หลายเดือนก่อน

    Didn't have any idea about the existence of subreaper. Thanks, this was very helpful.

  • @susmitamaitra2373
    @susmitamaitra2373 11 หลายเดือนก่อน

    It would be great if the video can be divided into time segments for each section.