X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8B77D38582A3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1702753651; bh=yW9G1aI2NUpePOfImFwcboFOCfjNDJoxMG5miV0PCa4=; h=References:In-Reply-To:Date:Subject:Cc:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=fLDPbKDVTVD8rTc6ELg4bG+DnsFXJqHBUo7ScBj98GNHTIxasGDRVwkeGMw+Z2J1B 5B6D/2Xo9mBqyPepyGIeKd6qNdIS8UK4vg5fU2hNGHgHhjnfQibqIK6dOi9BrrGs4N Tzv/LA9LLi2QHMnqt+DVszoI7y+jPKVPCDvULGkk= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 54FBB3858D28 ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 54FBB3858D28 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702753615; cv=none; b=qnwYrY9kD4iWDE+RQkzQZ6onm21Anqg0Rn9VIbkveeGrtI6+D23gZTRu4iPvpRvZgeSvvHdByp2Tl+6cbZe6gTk0Y3S/jEacjAZa8iUtHoAYM06mLVfoc1C+iJVLqVf+ng8V+FmWoVsPvLYUzdCmqo2p/NqgGjguf69849PpluU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702753615; c=relaxed/simple; bh=4gN3ob929IWyf/E9NUq32A9RFd3hW5U8wkszHLf0Y04=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject; b=TB0jL2lIABds+87/OrOiLvMOBzPsB9E0g4Lx0X153gujGbPQisHxQ59KcfZdqauZxXNX5bMAxuLCmY53wW8iPwxjdxjfi31YMy2S0ouQPzhY788BDjpANFNgqbIfF8kJhQdj9tkrOwd2+R8dN2zHANrehoIqTdrbI1t3066V62c= ARC-Authentication-Results: i=1; server2.sourceware.org X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702753612; x=1703358412; h=content-transfer-encoding:cc:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Cuorz5DsovI00SVTj/G42w2q5n/GgWVRLRYzLGdirTM=; b=KTWfanTYxEJ3b+WRtMtfEF0w+u0BLio8goqt+qg3Mn5nZXZ3eHu65D0o363d8o/629 5VcaOSQVZsAUUz0rZ6PD/6ymVSOZN2sQpQgroYLEXehiHwkYKelqWmtt/vEPJh2XdbZR iHhx5kztBpX8FLi+cm7YXzlXGLkP8q1YwPWpZRvl2J/QgCDEiQ+wRmvAfvGkYmwNNmzj 0ZPWzbgE3ojU+GHfzjSl8hKkup76uYCgbSF1ayic00/DWgdjmD17QH9cDEstWOM2OZdB QkAMSSTpx6EXvKFrK01dresuKvTKsbJV5yoQNJGErFH9mc3EOfhQ2EB1tkNU4ueBSzWV W3Xg== X-Gm-Message-State: AOJu0Yw/dYfw7dHwlO0nXv/5rd9r/9/0S2RZwWPVI2IGYHF4xzmokWCk wwaJTjG3KkPP7AbomxxCEWtMQPBroq7hYRn497itq4G/hvo= X-Google-Smtp-Source: AGHT+IGy3k5cdj4o8YjYRKTXa7iPTSpGIb8rp5PmlgtF4s0vUroC0wQLkAg3pVsuGA3ugEWEaMNpUQDlaggMui8dGWM= X-Received: by 2002:a17:90a:a50c:b0:28b:2895:9efd with SMTP id a12-20020a17090aa50c00b0028b28959efdmr3960494pjq.0.1702753612261; Sat, 16 Dec 2023 11:06:52 -0800 (PST) MIME-Version: 1.0 References: <910db078-35f2-00f8-0654-59c3c58535e3 AT cs DOT umass DOT edu> In-Reply-To: Date: Sat, 16 Dec 2023 11:06:39 -0800 Message-ID: Subject: Re: [EXTERNAL] Re: How efficient is 'sleep'? Cc: "cygwin AT cygwin DOT com" X-Spam-Status: No, score=1.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, MALFORMED_FREEMAIL, MISSING_HEADERS, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.30 List-Id: General Cygwin discussions and problem reports List-Archive: List-Post: List-Help: List-Subscribe: , From: Backwoods BC via Cygwin Reply-To: Backwoods BC Content-Type: text/plain; charset="utf-8" Sender: "Cygwin" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 3BGJ7W0B008787 On Sat, Dec 16, 2023 at 9:37 AM Lavrentiev, Anton (NIH/NLM/NCBI) [C] wrote: > > > the process isn't allocated any CPU time until the timer expires. > > Almost so. But the "sleep" functions are interruptible, so if a process (the "sleep" command) > is somehow signaled, it will wake up prematurely, and will have to either put itself back to > sleep (for the remaining unslept time) or terminate, whatever the implementation is. So in the > former case, there is some CPU still consumed (and that would depend on how often the signal > arrives), and in the former case, the actual slept time can be quite inaccurate (from what you > think it should have been). > > Signaling with scripts can be quite tricky as the signal can propagate to the entire process > group, rather than a single process (depending on which process the signal was sent to). > > Using cron (as others suggested) gives you a time accuracy up to a second (give or take), but > then again it depends on the load of the system, and may drift rather significantly. > > My $.02, > > Anton Lavrentiev > Contractor NIH/NLM/NCBI Thank you for the answers. This is a personal computer and nothing my "services" do cares much about the actual time between runs so the uncertainty using 'sleep' isn't an issue. Back in the XP days, I used a Windows version of 'cron' to run things, but it stopped working and I just modified the small number of scripts it launched to time themselves. I was just curious as to how much of a penalty I was paying for my laziness and you've confirmed that the answer is "not much." My computer has been slowing down and I was looking for the culprit, which is most likely just increasing software bloat (wheezy voice: "In my day, 4 kB was a huge program:) My current computer is not "Win 11 ready" and I'm not replacing perfectly functional hardware, so I will be migrating to a Linux desktop in 2025 (or sooner) and will have 'cron' available again. Again, thanks for the answers. -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple