Position: Home page » Equipment » Mining with timer

Mining with timer

Publish: 2021-05-21 22:00:54
1. Not suitable for mining, you can consider the interstellar bit, the latest proct hummingbird H1 is based on Linux system.
2.

Yes

please refer to the following tutorial:

Mining with idle Linux server

Mining tutorial of Ethereum Linux system

installation of zcash under Linux to start mining tutorial

3.

Yes, why not. Moreover, it is easy to operate and has the following advantages:

< UL >
  • it is more stable and easy to maintain

  • the cost of system resources is small (that is, the hardware requirements are not high), and the mining cost is saved

  • the installation and debugging are simple, and the technical threshold is lower

  • full open source system, free legal edition, more stable and further save mining cost? In fact, you only need two steps to mine under Linux system:

    open the website, enter the mobile phone number, select how many CPUs you want to use to mine, the default is to use 50% of the CPU to mine, click to generate your exclusive command and

    is such a simple operation

  • 4. Linux server mining, just need two steps
    open the website, enter the mobile phone number, select how many CPU you want to use to mine, the default is to use 50% of the CPU for mining, click to generate your exclusive command and
    enter the console paste command, and click Run
    is such a simple operation.
    5. Using select to realize precise timer under Linux
    when programming, we often use timer. This article describes how to use select to implement super clock. Using the select function, we can implement a timer with a subtle level of precision. At the same time, the select function is also a function that we often use when writing non blocking programs
    first of all, the prototype of select function is as follows:
    int select (int NFDS, FD)_ set *readfds, fd_ set *writefds,
    fd_ set *exceptfds, struct timeval *timeout);

    Parameter Description:
    the first parameter NFDS of slect is the maximum descriptor value plus 1 in the fdset set. Fdset is a group of digits whose size is limited to__ FD_ SetSize (1024), each bit of the bit group represents whether its corresponding descriptor needs to be checked
    the second, third, and fourth parameters of select indicate the bit array of file descriptors that need to pay attention to read, write, and error events. These parameters are both input and output parameters, and may be modified by the kernel to indicate which descriptors are concerned about. Therefore, fdset needs to be reinitialized before each call to select
    the timeout parameter is the timeout time. The structure will be modified by the kernel, and its value is the remaining time of the timeout
    when using select to implement timer, you need to use its timeout parameter. Note that:
    1) the select function uses a struct timeval as its parameter
    2) the select function will update the value of timeval, and the value of timeval is the remaining time
    if we specify the value of the parameter timeval and set all other parameters to 0 or null, the select function will return when the time runs out. Based on this, we can use select to achieve accurate timing< The structure of
    time is as follows:
    struct time {
    long TV_ sec/* secons*
    long tv_ usec;/* Microseconds * /
    }

    we can see that it is accurate to microseconds, that is, subtle
    one second timer

    void seconds_ sleep(unsigned seconds){
    struct timeval tv;< br /> tv.tv_ sec=seconds;< br /> tv.tv_ usec=0;< br /> int err;< br /> do{
    err=select(0,NULL,NULL,NULL,&tv);< br /> }while(err< 0 && errno==EINTR);< Second, the millisecond level timer

    void milliseconds_ sleep(unsigned long mSec){
    struct timeval tv;< br /> tv.tv_ sec=mSec/1000;< br /> tv.tv_ usec=(mSec%1000)*1000;< br /> int err;< br /> do{
    err=select(0,NULL,NULL,NULL,&tv);< br /> }while(err< 0 && errno==EINTR);<
    }

    three, subtle level timer

    void microseconds_ sleep(unsigned long uSec){
    struct timeval tv;< br /> tv.tv_ sec=uSec/1000000;< br /> tv.tv_ usec=uSec%1000000;< br /> int err;< br /> do{
    err=select(0,NULL,NULL,NULL,&tv);< br /> }while(err< 0 && errno==EINTR);< Now let's write a few lines of code to see the timing effect< br />
    #include < stdio.h>< br />#include < sys/time.h>< br />#include < errno.h>< br />int main()
    {
    int i;< br /> for(i=0; i< 5;++ i){
    printf("% d\ n", i);< br /> //seconds_ sleep(1);< br /> //milliseconds_ sleep(1500);< br /> microseconds_ sleep(1900000);
    }
    }

    note: Although a subtle level of resolution is specified in the timeval structure, the kernel support separation rate is often not so high. Many UNIX kernels round up the timeout value to a multiple of 10ms. In addition, coupled with the kernel scheling delay phenomenon, that is, after the timer time, the kernel also needs to spend a certain amount of time scheling the corresponding process. Therefore, the accuracy of the timer is ultimately determined by the separation rate supported by the kernel.
    6. 1 nanosleep function can provide the highest resolution, generally in nanosecond level
    2 the timing of select and poll function is in millisecond level, and pselect function is in nanosecond level
    all the above three functions can meet your requirements
    7. The 1
    nanosleep function can provide the highest resolution, which is generally nanosecond
    2
    the timing of select and poll functions is millisecond, and pselect is nanosecond
    all the above three functions can meet your requirements
    8. You can use the crontab command
    9. 1. RTC (real time clock)

    all PCs have RTC, which is independent of CPU and other chips. It can run normally after the computer is turned off. RTC can generate periodic interrupts on irq8. The frequency is 2Hz -- 8192hz.

    linux just uses RTC to get the time and date. Of course, it allows the process to program it through the / dev / RTC device. Kernel accesses RTC through I / O ports of 0x70 and 0x71< br />
     < The microprocessor on TSC (time stamp counter)

    80x86 has CLK input pin. Starting from Pentium series, the microprocessor supports a counter. Whenever a clock signal comes, the counter will add 1. The value of the counter can be obtained through the assembly instruction rdtsc. Through calibrate_ TSC can get the CPU frequency. It is confirmed by calculating the increment in TSC register in about 5 ms. Or you can get the CPU frequency through cat / proc / cpuinfo. TSC can provide more accurate time measurement than pit< br />
     

    3. Pit (programmable interval timer)

    in addition to RTC and TSC, IBM compatible computers provide pit. Pit is similar to the alarm mechanism of microwave oven. When the time is up, it provides a ring tone. Pit does not generate a ring tone, but a special interrupt called timer interrupt or clock interrupt. It is used to tell the kernel that an interval has passed. This interval is also called a tick count. You can choose the kernel frequency by compiling the kernel. If the kernel frequency is set to 1000Hz, the time interval or tick is 1 / 1000 = 1 microsecond. Short tick month. Higher timing accuracy. But shorter time in user mode. That is to say, the slower the program execution in user mode. The length of tick exists in the form of nanosecond tick_ In the nsec variable. The pit is accessed through port 0x40 -- 0x43 of 8254. The interrupt number is IRQ 0.

    here are some macro definitions in pit:

    Hz: interrupts per second< br />
    CLOCK_ TICK_ Rate: the value is 1193182. It is the internal oscillator frequency of 8254 chip

    latch: stands for clock_ TICK_ Rate and Hz ratio. Used to program pit< br />
    setup_ pit_ Timer () is as follows:

    spin_ lock_ irqsave(&i8253_ lock, flags);< br />
    outb_ p(0x34,0x43);< br />
    udelay(10);< br />
    outb_ p(LATCH & 0xff, 0x40);< br />
    udelay(10);< br />
    outb (LATCH >& gt; 8, 0x40);< br />
    spin_ unlock_ irqrestore(&i8253_ lock, flags);< br />
     < br />
     <

    4. CPU local timer

    recently, local APIC on 80x86 architecture microprocessor provides CPU local timer. It is different from pit in that it provides one shot and periodic interrupt. It enables interrupts to be sent to a specific CPU. One shot interrupt is often used in real-time system.
    10. 我自己随便写的,最后一个if执行条件改改就能用
    #!/bin/bash
    # #
    H=0
    M=0
    S=0

    while [ $S -lt 60 ]; do
    S=$[ $S+1 ]
    if [ $S -eq 60 ];then
    S=0 && M=$[ $M + 1 ]
    fi

    if [ $M -eq 60 ];then
    M=0 && H=$[ $H + 1 ]
    fi
    sleep 1
    echo "$H:$M:$S"
    done

    ~ ~ ~ ~ ~ "test3.sh" 21L, 240C 5,1 All
    Hot content
    Inn digger Publish: 2021-05-29 20:04:36 Views: 341
    Purchase of virtual currency in trust contract dispute Publish: 2021-05-29 20:04:33 Views: 942
    Blockchain trust machine Publish: 2021-05-29 20:04:26 Views: 720
    Brief introduction of ant mine Publish: 2021-05-29 20:04:25 Views: 848
    Will digital currency open in November Publish: 2021-05-29 19:56:16 Views: 861
    Global digital currency asset exchange Publish: 2021-05-29 19:54:29 Views: 603
    Mining chip machine S11 Publish: 2021-05-29 19:54:26 Views: 945
    Ethereum algorithm Sha3 Publish: 2021-05-29 19:52:40 Views: 643
    Talking about blockchain is not reliable Publish: 2021-05-29 19:52:26 Views: 754
    Mining machine node query Publish: 2021-05-29 19:36:37 Views: 750